org.activeio
Interface Packet

All Superinterfaces:
Disposable
All Known Implementing Classes:
AppendedPacket, ByteArrayPacket, ByteBufferPacket, BytePacket, EmptyPacket, EOSPacket, FilterPacket

public interface Packet
extends Disposable

Provides a ByteBuffer like interface to work with IO channel packets of data.

Version:
$Revision$

Nested Class Summary
static class Packet.ByteSequence
           
 
Method Summary
 Packet.ByteSequence asByteSequence()
           
 int capacity()
           
 void clear()
           
 Packet duplicate()
           
 Object duplicate(ClassLoader cl)
           
 void flip()
           
 boolean hasRemaining()
           
 int limit()
           
 void limit(int limit)
           
 Object narrow(Class target)
          Used to get a richer metadata interface to the packet.
 int position()
           
 void position(int position)
           
 int read()
           
 int read(byte[] data, int offset, int length)
           
 int read(Packet dest)
           
 int remaining()
           
 void rewind()
           
 Packet slice()
           
 byte[] sliceAsBytes()
           
 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.
 
Methods inherited from interface org.activeio.Disposable
dispose
 

Method Detail

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()

clear

public void clear()

slice

public Packet slice()

duplicate

public Packet duplicate()

duplicate

public Object duplicate(ClassLoader cl)
                 throws IOException
Throws:
IOException

capacity

public int capacity()

asByteSequence

public Packet.ByteSequence asByteSequence()

sliceAsBytes

public byte[] sliceAsBytes()

writeTo

public void writeTo(OutputStream out)
             throws IOException
Writes the remaing bytes in the packet to the output stream.

Parameters:
out -
Returns:
Throws:
IOException

writeTo

public void writeTo(DataOutput out)
             throws IOException
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)

read

public int read(Packet dest)

narrow

public Object narrow(Class target)
Used to get a richer metadata interface to the packet.



Copyright © -2007 The ActiveIO Project. All Rights Reserved.