org.activeio.packet
Class BytePacket
java.lang.Object
org.activeio.packet.BytePacket
- All Implemented Interfaces:
- Disposable, Packet
- public final class BytePacket
- extends Object
- implements Packet
Provides a Packet implementation that is directly backed by a byte
.
- Version:
- $Revision$
BytePacket
public BytePacket(byte data)
position
public int position()
- Specified by:
position
in interface Packet
position
public void position(int position)
- Specified by:
position
in interface Packet
limit
public int limit()
- Specified by:
limit
in interface Packet
limit
public void limit(int limit)
- Specified by:
limit
in interface Packet
flip
public void flip()
- Specified by:
flip
in interface Packet
remaining
public int remaining()
- Specified by:
remaining
in interface Packet
rewind
public void rewind()
- Specified by:
rewind
in interface Packet
hasRemaining
public boolean hasRemaining()
- Specified by:
hasRemaining
in interface Packet
clear
public void clear()
- Specified by:
clear
in interface Packet
capacity
public int capacity()
- Specified by:
capacity
in interface Packet
slice
public Packet slice()
- Specified by:
slice
in interface Packet
duplicate
public Packet duplicate()
- Specified by:
duplicate
in interface Packet
duplicate
public Object duplicate(ClassLoader cl)
throws IOException
- Specified by:
duplicate
in interface Packet
- Throws:
IOException
writeTo
public void writeTo(OutputStream out)
throws IOException
- Description copied from interface:
Packet
- Writes the remaing bytes in the packet to the output stream.
- Specified by:
writeTo
in interface Packet
- Parameters:
out
-
- Returns:
-
- Throws:
IOException
writeTo
public void writeTo(DataOutput out)
throws IOException
- Specified by:
writeTo
in interface Packet
- Throws:
IOException
read
public int read()
- Specified by:
read
in interface Packet
- See Also:
Packet.read()
read
public int read(byte[] data,
int offset,
int length)
- Specified by:
read
in interface Packet
- See Also:
Packet.read(byte[], int, int)
write
public boolean write(int data)
- Specified by:
write
in interface Packet
- See Also:
Packet.write(int)
write
public int write(byte[] data,
int offset,
int length)
- Specified by:
write
in interface Packet
- See Also:
Packet.write(byte[], int, int)
asByteSequence
public Packet.ByteSequence asByteSequence()
- Specified by:
asByteSequence
in interface Packet
sliceAsBytes
public byte[] sliceAsBytes()
- Specified by:
sliceAsBytes
in interface Packet
- See Also:
Packet.sliceAsBytes()
read
public int read(Packet dest)
- Specified by:
read
in interface Packet
- Parameters:
dest
-
- Returns:
- the number of bytes read into the dest.
toString
public String toString()
narrow
public Object narrow(Class target)
- Description copied from interface:
Packet
- Used to get a richer metadata interface to the packet.
- Specified by:
narrow
in interface Packet
dispose
public void dispose()
- Description copied from interface:
Disposable
- This method should not throw any exceptions. Cleaning up a Disposable object
should be easy of an end user therefore do not make him have to handle an Exception.
- Specified by:
dispose
in interface Disposable
Copyright © -2007 The ActiveIO Project. All Rights Reserved.