org.objectweb.jonathan.protocols.tcpip

Class TcpIpChunkProvider

Implemented Interfaces:
ChunkProvider

public class TcpIpChunkProvider
extends Chunk
implements ChunkProvider

TcpIpChunkProvider is a ChunkProvider implementation encapsulating a socket input stream.

Field Summary

Fields inherited from class org.objectweb.jonathan.resources.api.Chunk

data, next, offset, top

Method Summary

void
close()
Chunk
duplicate()
Duplicates the whole chunk.
Chunk
duplicate(int off, int t)
Partially duplicates this chunk.
protected void
finalize()
Chunk
prepare()
void
release()
Releases the chunk.

Methods inherited from class org.objectweb.jonathan.resources.api.Chunk

duplicate, duplicate, release, toString

Method Details

close

public void close()
Specified by:
close in interface ChunkProvider


duplicate

public Chunk duplicate()
            throws JonathanException
Duplicates the whole chunk.

The default implementation copies the buffer, and creates a new chunk with it.

Overrides:
duplicate in interface Chunk

Returns:
a copy of this chunk.


duplicate

public Chunk duplicate(int off,
                       int t)
            throws JonathanException
Partially duplicates this chunk. 'offset' must be greater than the target chunk's offset, 'top' must be less or equal than the target's top.

The default implementation copies the appropriate portion of the buffer, and creates a new chunk with it.

Overrides:
duplicate in interface Chunk

Parameters:

Returns:
a chunk containing the specified part of the target chunk.


finalize

protected void finalize()


prepare

public Chunk prepare()
            throws JonathanException
Specified by:
prepare in interface ChunkProvider


release

public void release()
Releases the chunk. The data of a chunk may be obtained from managed buffers. It may thus be necessary to tell when the data encapsulated by a chunk may be reused.

The default implementation resets offset and top to 0.

Overrides:
release in interface Chunk