Package org.apache.activeio.packet
Class BytePacket
java.lang.Object
org.apache.activeio.packet.BytePacket
- All Implemented Interfaces:
Packet
Provides a Packet implementation that is directly backed by a
byte
.- Version:
- $Revision$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
void
clear()
void
dispose()
duplicate
(ClassLoader cl) void
flip()
getAdapter
(Class target) boolean
int
limit()
void
limit
(int limit) int
position()
void
position
(int position) 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.
-
Constructor Details
-
BytePacket
public BytePacket(byte data)
-
-
Method Details
-
position
public int position() -
position
public void position(int position) -
limit
public int limit() -
limit
public void limit(int limit) -
flip
public void flip() -
remaining
public int remaining() -
rewind
public void rewind() -
hasRemaining
public boolean hasRemaining()- Specified by:
hasRemaining
in interfacePacket
-
clear
public void clear() -
capacity
public int capacity() -
slice
-
duplicate
-
duplicate
- Specified by:
duplicate
in interfacePacket
- Throws:
IOException
-
writeTo
Description copied from interface:Packet
Writes the remaing bytes in the packet to the output stream.- Specified by:
writeTo
in interfacePacket
- Parameters:
out
-- Throws:
IOException
-
writeTo
- Specified by:
writeTo
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
-
sliceAsBytes
public byte[] sliceAsBytes()- Specified by:
sliceAsBytes
in interfacePacket
- See Also:
-
read
-
toString
-
getAdapter
- Specified by:
getAdapter
in interfacePacket
-
dispose
public void dispose()
-