Package org.h2gis.functions.io.utility

## Class WriteBufferManager

- java.lang.Object
- - org.h2gis.functions.io.utility.WriteBufferManager

    public final class WriteBufferManager
    extends Object

Class to write files using nio.

Author:
  Fernando Gonzalez Cortes

### Constructor Summary

Constructors
`WriteBufferManager​(FileChannel channel)` Creates a new WriteBufferManager that writes to the specified file channel

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()`
`void` `flip()`
`void` `flush()` flushes the cached contents into the channel.
`ByteBuffer` `getBuffer()`
`void` `order​(ByteOrder order)` Specifies the byte order.
`int` `position()`
`void` `putBytes​(byte[] byteArray)`
`void` `putBytes​(byte[] byteArray, int offset, int length)`
`void` `putDouble​(double d)` Puts the specified double at the current position
`void` `putFloat​(float value)`
`void` `putInt​(int value)` Puts the specified int at the current position
`void` `putLong​(long value)`
`void` `putShort​(byte b)` Puts the specified byte at the current position
`void` `putShort​(byte[] bs)` Puts the specified bytes at the current position
`void` `putShort​(short i)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### WriteBufferManager

    public WriteBufferManager​(FileChannel channel)
                       throws IOException

Creates a new WriteBufferManager that writes to the specified file channel

Parameters:
  `channel` - `FileChannel`
Throws:
  `IOException`

### Method Detail

#### putShort

    public void putShort​(byte b)
                  throws IOException

Puts the specified byte at the current position

Parameters:
  `b` - put a short value
Throws:
  `IOException`

#### position

    public int position()

#### putShort

    public void putShort​(byte[] bs)
                  throws IOException

Puts the specified bytes at the current position

Parameters:
  `bs` - put short value
Throws:
  `IOException`

#### flush

    public void flush()
               throws IOException

flushes the cached contents into the channel. It is mandatory to call this method to finish the writing of the channel

Throws:
  `IOException`

#### order

    public void order​(ByteOrder order)

Specifies the byte order. One of the constants in `ByteBuffer`

Parameters:
  `order` - `ByteOrder`

#### putInt

    public void putInt​(int value)
                throws IOException

Puts the specified int at the current position

Parameters:
  `value` - put int value
Throws:
  `IOException`

#### putDouble

    public void putDouble​(double d)
                   throws IOException

Puts the specified double at the current position

Parameters:
  `d` - put double value
Throws:
  `IOException`

#### flip

    public void flip()

#### getBuffer

    public ByteBuffer getBuffer()

#### putShort

    public void putShort​(short i)
                  throws IOException

Throws:
  `IOException`

#### putFloat

    public void putFloat​(float value)
                  throws IOException

Throws:
  `IOException`

#### putLong

    public void putLong​(long value)
                 throws IOException

Throws:
  `IOException`

#### putBytes

    public void putBytes​(byte[] byteArray)
                  throws IOException

Throws:
  `IOException`

#### putBytes

    public void putBytes​(byte[] byteArray,
                         int offset,
                         int length)
                  throws IOException

Throws:
  `IOException`

#### clear

    public void clear()