org.graphstream.stream.netstream.packing
Class NetStreamUnpacker

java.lang.Object
  extended by org.graphstream.stream.netstream.packing.NetStreamUnpacker
Direct Known Subclasses:
Base64Unpacker

public abstract class NetStreamUnpacker
extends Object


Constructor Summary
NetStreamUnpacker()
           
 
Method Summary
abstract  int sizeOfInt()
          An unpacker has to be abble to indicated what is the size of an int after being packed.
 ByteBuffer unpackMessage(ByteBuffer buffer)
          Unpack the given ByteBuffer
abstract  ByteBuffer unpackMessage(ByteBuffer buffer, int startIndex, int endIndex)
          Unpack the given ByteBuffer from startIndex to endIdex
abstract  int unpackMessageSize(ByteBuffer buffer)
          Unpacks the data necessary to decode a 4 bytes integer that indicates the size of the following message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetStreamUnpacker

public NetStreamUnpacker()
Method Detail

sizeOfInt

public abstract int sizeOfInt()
An unpacker has to be abble to indicated what is the size of an int after being packed.

Returns:

unpackMessage

public abstract ByteBuffer unpackMessage(ByteBuffer buffer,
                                         int startIndex,
                                         int endIndex)
Unpack the given ByteBuffer from startIndex to endIdex

Parameters:
buffer - The buffer to unpack/decode
startIndex - the index at which the decoding starts in the buffer
endIndex - the index at which the decoding stops
Returns:
a ByteBuffer that is the unpacked version of the input one. It may not have the same size.

unpackMessage

public ByteBuffer unpackMessage(ByteBuffer buffer)
Unpack the given ByteBuffer

Parameters:
buffer - The buffer to unpack/decode
Returns:
a ByteBuffer that is the unpacked version of the input one. It may not have the same size.

unpackMessageSize

public abstract int unpackMessageSize(ByteBuffer buffer)
Unpacks the data necessary to decode a 4 bytes integer that indicates the size of the following message. The given buffer's position may be important for the unpacker to work. This method may also change the given bytebuffer's position attribute.

Parameters:
buffer - The byteBuffer who's content has the encoded value of the needed size integer.
Returns:


Copyright © 2013. All Rights Reserved.