Package org.apache.activeio.packet
Interface Packet
- All Known Implementing Classes:
AppendedPacket
,ByteArrayPacket
,ByteBufferPacket
,BytePacket
,EmptyPacket
,EOSPacket
,FilterPacket
,PacketPool.PooledPacket
public interface Packet
Provides a ByteBuffer like interface to work with IO channel packets of data.
- Version:
- $Revision$
-
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[]
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.
-
Method Details
-
position
int position() -
position
void position(int position) -
limit
int limit() -
limit
void limit(int limit) -
flip
void flip() -
remaining
int remaining() -
rewind
void rewind() -
hasRemaining
boolean hasRemaining() -
clear
void clear() -
slice
Packet slice() -
duplicate
Packet duplicate() -
duplicate
- Throws:
IOException
-
capacity
int capacity() -
dispose
void dispose() -
asByteSequence
ByteSequence asByteSequence() -
sliceAsBytes
byte[] sliceAsBytes() -
getAdapter
-
writeTo
Writes the remaing bytes in the packet to the output stream.- Parameters:
out
-- Throws:
IOException
-
writeTo
- Throws:
IOException
-
read
int read() -
read
int read(byte[] data, int offset, int length) -
write
boolean write(int data) -
write
int write(byte[] data, int offset, int length) -
read
-