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 Constructor Description WriteBufferManager(FileChannel channel)Creates a new WriteBufferManager that writes to the specified file channel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidflip()voidflush()flushes the cached contents into the channel.ByteBuffergetBuffer()voidorder(ByteOrder order)Specifies the byte order.intposition()voidputBytes(byte[] byteArray)voidputBytes(byte[] byteArray, int offset, int length)voidputDouble(double d)Puts the specified double at the current positionvoidputFloat(float value)voidputInt(int value)Puts the specified int at the current positionvoidputLong(long value)voidputShort(byte b)Puts the specified byte at the current positionvoidputShort(byte[] bs)Puts the specified bytes at the current positionvoidputShort(short i)
-
-
-
Constructor Detail
-
WriteBufferManager
public WriteBufferManager(FileChannel channel) throws IOException
Creates a new WriteBufferManager that writes to the specified file channel- Parameters:
channel-- Throws:
IOException
-
-
Method Detail
-
putShort
public void putShort(byte b) throws IOExceptionPuts the specified byte at the current position- Parameters:
b-- Throws:
IOException
-
position
public int position()
-
putShort
public void putShort(byte[] bs) throws IOExceptionPuts the specified bytes at the current position- Parameters:
bs-- Throws:
IOException
-
flush
public void flush() throws IOExceptionflushes 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 inByteBuffer- Parameters:
order-
-
putInt
public void putInt(int value) throws IOExceptionPuts the specified int at the current position- Parameters:
value-- Throws:
IOException
-
putDouble
public void putDouble(double d) throws IOExceptionPuts the specified double at the current position- Parameters:
d-- 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()
-
-