Package org.apache.activeio.packet
Class ByteBufferPacket
- java.lang.Object
-
- org.apache.activeio.packet.ByteBufferPacket
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BUFFER_SIZE
static int
DEFAULT_DIRECT_BUFFER_SIZE
-
Constructor Summary
Constructors Constructor Description ByteBufferPacket(java.nio.ByteBuffer buffer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteSequence
asByteSequence()
int
capacity()
void
clear()
Packet
compact()
static ByteBufferPacket
createDefaultBuffer(boolean direct)
void
dispose()
Packet
duplicate()
java.lang.Object
duplicate(java.lang.ClassLoader cl)
void
flip()
java.lang.Object
getAdapter(java.lang.Class target)
java.nio.ByteBuffer
getByteBuffer()
boolean
hasRemaining()
boolean
isDirect()
boolean
isReadOnly()
int
limit()
void
limit(int arg0)
Packet
mark()
int
position()
void
position(int arg0)
int
read()
int
read(byte[] data, int offset, int length)
int
read(Packet dest)
int
remaining()
void
rewind()
Packet
slice()
byte[]
sliceAsBytes()
java.lang.String
toString()
int
write(byte[] data, int offset, int length)
boolean
write(int data)
void
writeTo(java.io.DataOutput out)
void
writeTo(java.io.OutputStream out)
Writes the remaing bytes in the packet to the output stream.
-
-
-
Method Detail
-
getByteBuffer
public java.nio.ByteBuffer getByteBuffer()
-
createDefaultBuffer
public static ByteBufferPacket createDefaultBuffer(boolean direct)
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOException
Description copied from interface:Packet
Writes the remaing bytes in the packet to the output stream.
-
writeTo
public void writeTo(java.io.DataOutput out) throws java.io.IOException
-
compact
public Packet compact()
-
hasRemaining
public boolean hasRemaining()
- Specified by:
hasRemaining
in interfacePacket
-
isDirect
public boolean isDirect()
-
isReadOnly
public boolean isReadOnly()
-
mark
public Packet mark()
-
duplicate
public java.lang.Object duplicate(java.lang.ClassLoader cl) throws java.io.IOException
-
read
public int read()
- Specified by:
read
in interfacePacket
- See Also:
Packet.read()
-
read
public int read(byte[] data, int offset, int length)
- Specified by:
read
in interfacePacket
- See Also:
Packet.read(byte[], int, int)
-
write
public boolean write(int data)
- Specified by:
write
in interfacePacket
- See Also:
Packet.write(int)
-
write
public int write(byte[] data, int offset, int length)
- Specified by:
write
in interfacePacket
- See Also:
Packet.write(byte[], int, int)
-
asByteSequence
public ByteSequence asByteSequence()
- Specified by:
asByteSequence
in interfacePacket
- See Also:
Packet.asByteSequence()
-
sliceAsBytes
public byte[] sliceAsBytes()
- Specified by:
sliceAsBytes
in interfacePacket
- See Also:
Packet.sliceAsBytes()
-
read
public int read(Packet dest)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAdapter
public java.lang.Object getAdapter(java.lang.Class target)
- Specified by:
getAdapter
in interfacePacket
-
-