|
deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.utils.nio.BufferSerializer
public class BufferSerializer
The BufferSerializer
class TODO add class documentation here.
Constructor Summary | |
---|---|
BufferSerializer()
|
Method Summary | |
---|---|
static ByteBuffer |
readByteBufferFromStream(DataInputStream in,
boolean direct)
Reads a number of bytes from the stream and fills a direct, native ByteBuffer with them. |
static FloatBuffer |
readFloatBufferFromStream(DataInputStream in,
boolean direct)
Reads a number of floats from the stream and fills a direct, native FloatBuffer with them. |
static void |
writeBufferToStream(Buffer buffer,
DataOutputStream out)
Writes a buffer to the given output stream by checking the instance of the buffer and writing the native values appropriately. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferSerializer()
Method Detail |
---|
public static void writeBufferToStream(Buffer buffer, DataOutputStream out) throws IOException
IOException
occurs. The 'size' integer will in this case not be set to -1 and will not contain the
correct number of 'native-types' to read.
buffer
- out
-
IOException
public static FloatBuffer readFloatBufferFromStream(DataInputStream in, boolean direct) throws IOException
The callee has to ensure that this method is called in it's right time, so that the next read to the stream gives
an int and the read(s) thereafter will result in the number of values denoted by the first int value. Using this
class will result in a correct order. The following code will result in correct reading and writing of the
buffers:
FloatBuffer myFloatBuffer;
private void writeObject( ObjectOutputStream out ){
BufferSerializer.writeBufferToStream( out, myFloatBuffer );
}
private void readObject( ObjectInputStream in ){
myFloatBuffer = BufferSerializer.readFloatBufferFromStream( in );
}
in
- direct
-
null
if no indication of the number of floats to read has been made.
IOException
public static ByteBuffer readByteBufferFromStream(DataInputStream in, boolean direct) throws IOException
The callee has to ensure that this method is called in it's right time, so that the next read to the stream gives
an int and the read(s) thereafter will result in the number of values denoted by the first int value. Using this
class will result in a correct order. The following code will result in correct reading and writing of the
buffers:
ByteBuffer myByteBuffer;
private void writeObject( ObjectOutputStream out ){
BufferSerializer.writeBufferToStream( out, myByteBuffer );
}
private void readObject( ObjectInputStream in ){
myByteBuffer = BufferSerializer.readByteBufferFromStream( in );
}
in
- direct
-
null
if no indication of the number of floats to read has been made.
IOException
|
deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |