Package org.apache.activeio.packet
Class ByteBufferPacket
java.lang.Object
org.apache.activeio.packet.ByteBufferPacket
- All Implemented Interfaces:
Packet
Provides a Packet implementation that is backed by a
- Version:
- $Revision$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
void
clear()
compact()
static ByteBufferPacket
createDefaultBuffer
(boolean direct) void
dispose()
duplicate
(ClassLoader cl) void
flip()
getAdapter
(Class target) boolean
boolean
isDirect()
boolean
int
limit()
void
limit
(int arg0) mark()
int
position()
void
position
(int arg0) int
read()
int
read
(byte[] data, int offset, int length) int
int
void
rewind()
slice()
byte[]
toString()
int
write
(byte[] data, int offset, int length) boolean
write
(int data) void
writeTo
(DataOutput out) void
writeTo
(OutputStream out) Writes the remaing bytes in the packet to the output stream.
-
Field Details
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE -
DEFAULT_DIRECT_BUFFER_SIZE
public static final int DEFAULT_DIRECT_BUFFER_SIZE
-
-
Constructor Details
-
ByteBufferPacket
-
-
Method Details
-
getByteBuffer
-
createDefaultBuffer
-
writeTo
Description copied from interface:Packet
Writes the remaing bytes in the packet to the output stream.- Specified by:
writeTo
in interfacePacket
- Throws:
IOException
-
writeTo
- Specified by:
writeTo
in interfacePacket
- Throws:
IOException
-
capacity
public int capacity() -
clear
public void clear() -
compact
-
flip
public void flip() -
hasRemaining
public boolean hasRemaining()- Specified by:
hasRemaining
in interfacePacket
-
isDirect
public boolean isDirect() -
isReadOnly
public boolean isReadOnly() -
limit
public int limit() -
limit
public void limit(int arg0) -
mark
-
position
public int position() -
position
public void position(int arg0) -
remaining
public int remaining() -
rewind
public void rewind() -
slice
-
duplicate
-
duplicate
- Specified by:
duplicate
in interfacePacket
- Throws:
IOException
-
read
public int read() -
read
public int read(byte[] data, int offset, int length) -
write
public boolean write(int data) -
write
public int write(byte[] data, int offset, int length) -
asByteSequence
- Specified by:
asByteSequence
in interfacePacket
- See Also:
-
sliceAsBytes
public byte[] sliceAsBytes()- Specified by:
sliceAsBytes
in interfacePacket
- See Also:
-
read
-
toString
-
getAdapter
- Specified by:
getAdapter
in interfacePacket
-
dispose
public void dispose()
-