net.gleamynode.netty.buffer
Class AbstractChannelBuffer

java.lang.Object
  extended by net.gleamynode.netty.buffer.AbstractChannelBuffer
All Implemented Interfaces:
Comparable<ChannelBuffer>, ChannelBuffer
Direct Known Subclasses:
ByteBufferBackedChannelBuffer, CompositeChannelBuffer, DuplicatedChannelBuffer, DynamicChannelBuffer, HeapChannelBuffer, ReadOnlyChannelBuffer, SlicedChannelBuffer, TruncatedChannelBuffer

public abstract class AbstractChannelBuffer
extends Object
implements ChannelBuffer

Version:
$Rev$, $Date$
Author:
The Netty Project (netty@googlegroups.com), Trustin Lee (trustin@gmail.com)

Field Summary
 
Fields inherited from interface net.gleamynode.netty.buffer.ChannelBuffer
EMPTY_BUFFER
 
Constructor Summary
AbstractChannelBuffer()
           
 
Method Summary
protected  void checkReadableBytes(int minimumReadableBytes)
           
 void clear()
           
protected  void clearHashCode()
           
 int compareTo(ChannelBuffer that)
          Compares the content of the specified buffer to the content of this buffer.
 ChannelBuffer copy()
           
 void discardReadBytes()
           
 boolean equals(Object o)
          Determines if the content of the specified buffer is identical to the content of this array.
 void getBytes(int index, byte[] dst)
           
 void getBytes(int index, ChannelBuffer dst)
           
 int hashCode()
          Returns a hash code which was calculated from the content of this buffer.
 int indexOf(int fromIndex, int toIndex, byte value)
           
 int indexOf(int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder)
           
 void markReaderIndex()
           
 void markWriterIndex()
           
 boolean readable()
           
 int readableBytes()
           
 byte readByte()
           
 ChannelBuffer readBytes()
           
 void readBytes(byte[] dst)
           
 void readBytes(byte[] dst, int dstIndex, int length)
           
 void readBytes(ByteBuffer dst)
           
 void readBytes(ChannelBuffer dst)
           
 ChannelBuffer readBytes(ChannelBufferIndexFinder endIndexFinder)
           
 void readBytes(ChannelBuffer dst, int length)
           
 void readBytes(ChannelBuffer dst, int dstIndex, int length)
           
 int readBytes(GatheringByteChannel out, int length)
           
 ChannelBuffer readBytes(int length)
           
 void readBytes(OutputStream out, int length)
           
 int readerIndex()
           
 void readerIndex(int readerIndex)
           
 int readInt()
           
 long readLong()
           
 int readMedium()
           
 short readShort()
           
 void resetReaderIndex()
           
 void resetWriterIndex()
           
 void setBytes(int index, byte[] src)
           
 void setBytes(int index, ChannelBuffer src)
           
 void setIndex(int readerIndex, int writerIndex)
           
 int skipBytes(ChannelBufferIndexFinder firstIndexFinder)
           
 void skipBytes(int length)
           
 ChannelBuffer slice()
           
 ByteBuffer toByteBuffer()
           
 ByteBuffer[] toByteBuffers()
           
 ByteBuffer[] toByteBuffers(int index, int length)
           
 String toString()
          Returns the string representation of this buffer.
 boolean writable()
           
 int writableBytes()
           
 void writeByte(byte value)
           
 void writeBytes(byte[] src)
           
 void writeBytes(byte[] src, int srcIndex, int length)
           
 void writeBytes(ByteBuffer src)
           
 void writeBytes(ChannelBuffer src)
           
 void writeBytes(ChannelBuffer src, int length)
           
 void writeBytes(ChannelBuffer src, int srcIndex, int length)
           
 void writeBytes(InputStream in, int length)
           
 int writeBytes(ScatteringByteChannel in, int length)
           
 void writeInt(int value)
           
 void writeLong(long value)
           
 void writeMedium(int value)
           
 void writePlaceholder(int length)
           
 int writerIndex()
           
 void writerIndex(int writerIndex)
           
 void writeShort(short value)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.gleamynode.netty.buffer.ChannelBuffer
capacity, copy, duplicate, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getInt, getLong, getMedium, getShort, order, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setLong, setMedium, setShort, slice, toByteBuffer
 

Constructor Detail

AbstractChannelBuffer

public AbstractChannelBuffer()
Method Detail

readerIndex

public int readerIndex()
Specified by:
readerIndex in interface ChannelBuffer

readerIndex

public void readerIndex(int readerIndex)
Specified by:
readerIndex in interface ChannelBuffer

writerIndex

public int writerIndex()
Specified by:
writerIndex in interface ChannelBuffer

writerIndex

public void writerIndex(int writerIndex)
Specified by:
writerIndex in interface ChannelBuffer

setIndex

public void setIndex(int readerIndex,
                     int writerIndex)
Specified by:
setIndex in interface ChannelBuffer

clear

public void clear()
Specified by:
clear in interface ChannelBuffer

readable

public boolean readable()
Specified by:
readable in interface ChannelBuffer

writable

public boolean writable()
Specified by:
writable in interface ChannelBuffer

readableBytes

public int readableBytes()
Specified by:
readableBytes in interface ChannelBuffer

writableBytes

public int writableBytes()
Specified by:
writableBytes in interface ChannelBuffer

markReaderIndex

public void markReaderIndex()
Specified by:
markReaderIndex in interface ChannelBuffer

resetReaderIndex

public void resetReaderIndex()
Specified by:
resetReaderIndex in interface ChannelBuffer

markWriterIndex

public void markWriterIndex()
Specified by:
markWriterIndex in interface ChannelBuffer

resetWriterIndex

public void resetWriterIndex()
Specified by:
resetWriterIndex in interface ChannelBuffer

discardReadBytes

public void discardReadBytes()
Specified by:
discardReadBytes in interface ChannelBuffer

getBytes

public void getBytes(int index,
                     byte[] dst)
Specified by:
getBytes in interface ChannelBuffer

getBytes

public void getBytes(int index,
                     ChannelBuffer dst)
Specified by:
getBytes in interface ChannelBuffer

setBytes

public void setBytes(int index,
                     byte[] src)
Specified by:
setBytes in interface ChannelBuffer

setBytes

public void setBytes(int index,
                     ChannelBuffer src)
Specified by:
setBytes in interface ChannelBuffer

readByte

public byte readByte()
Specified by:
readByte in interface ChannelBuffer

readShort

public short readShort()
Specified by:
readShort in interface ChannelBuffer

readMedium

public int readMedium()
Specified by:
readMedium in interface ChannelBuffer

readInt

public int readInt()
Specified by:
readInt in interface ChannelBuffer

readLong

public long readLong()
Specified by:
readLong in interface ChannelBuffer

readBytes

public ChannelBuffer readBytes()
Specified by:
readBytes in interface ChannelBuffer

readBytes

public ChannelBuffer readBytes(int length)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public ChannelBuffer readBytes(ChannelBufferIndexFinder endIndexFinder)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public void readBytes(byte[] dst,
                      int dstIndex,
                      int length)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public void readBytes(byte[] dst)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public void readBytes(ChannelBuffer dst)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public void readBytes(ChannelBuffer dst,
                      int length)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public void readBytes(ChannelBuffer dst,
                      int dstIndex,
                      int length)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public void readBytes(ByteBuffer dst)
Specified by:
readBytes in interface ChannelBuffer

readBytes

public int readBytes(GatheringByteChannel out,
                     int length)
              throws IOException
Specified by:
readBytes in interface ChannelBuffer
Throws:
IOException

readBytes

public void readBytes(OutputStream out,
                      int length)
               throws IOException
Specified by:
readBytes in interface ChannelBuffer
Throws:
IOException

skipBytes

public void skipBytes(int length)
Specified by:
skipBytes in interface ChannelBuffer

skipBytes

public int skipBytes(ChannelBufferIndexFinder firstIndexFinder)
Specified by:
skipBytes in interface ChannelBuffer

writeByte

public void writeByte(byte value)
Specified by:
writeByte in interface ChannelBuffer

writeShort

public void writeShort(short value)
Specified by:
writeShort in interface ChannelBuffer

writeMedium

public void writeMedium(int value)
Specified by:
writeMedium in interface ChannelBuffer

writeInt

public void writeInt(int value)
Specified by:
writeInt in interface ChannelBuffer

writeLong

public void writeLong(long value)
Specified by:
writeLong in interface ChannelBuffer

writeBytes

public void writeBytes(byte[] src,
                       int srcIndex,
                       int length)
Specified by:
writeBytes in interface ChannelBuffer

writeBytes

public void writeBytes(byte[] src)
Specified by:
writeBytes in interface ChannelBuffer

writeBytes

public void writeBytes(ChannelBuffer src)
Specified by:
writeBytes in interface ChannelBuffer

writeBytes

public void writeBytes(ChannelBuffer src,
                       int length)
Specified by:
writeBytes in interface ChannelBuffer

writeBytes

public void writeBytes(ChannelBuffer src,
                       int srcIndex,
                       int length)
Specified by:
writeBytes in interface ChannelBuffer

writeBytes

public void writeBytes(ByteBuffer src)
Specified by:
writeBytes in interface ChannelBuffer

writeBytes

public void writeBytes(InputStream in,
                       int length)
                throws IOException
Specified by:
writeBytes in interface ChannelBuffer
Throws:
IOException

writeBytes

public int writeBytes(ScatteringByteChannel in,
                      int length)
               throws IOException
Specified by:
writeBytes in interface ChannelBuffer
Throws:
IOException

writePlaceholder

public void writePlaceholder(int length)
Specified by:
writePlaceholder in interface ChannelBuffer

copy

public ChannelBuffer copy()
Specified by:
copy in interface ChannelBuffer

slice

public ChannelBuffer slice()
Specified by:
slice in interface ChannelBuffer

toByteBuffer

public ByteBuffer toByteBuffer()
Specified by:
toByteBuffer in interface ChannelBuffer

toByteBuffers

public ByteBuffer[] toByteBuffers()
Specified by:
toByteBuffers in interface ChannelBuffer

toByteBuffers

public ByteBuffer[] toByteBuffers(int index,
                                  int length)
Specified by:
toByteBuffers in interface ChannelBuffer

indexOf

public int indexOf(int fromIndex,
                   int toIndex,
                   byte value)
Specified by:
indexOf in interface ChannelBuffer

indexOf

public int indexOf(int fromIndex,
                   int toIndex,
                   ChannelBufferIndexFinder indexFinder)
Specified by:
indexOf in interface ChannelBuffer

hashCode

public int hashCode()
Description copied from interface: ChannelBuffer
Returns a hash code which was calculated from the content of this buffer. If there's a byte array which is equal to this array, both arrays should return the same value.

Specified by:
hashCode in interface ChannelBuffer
Overrides:
hashCode in class Object

clearHashCode

protected void clearHashCode()

equals

public boolean equals(Object o)
Description copied from interface: ChannelBuffer
Determines if the content of the specified buffer is identical to the content of this array. 'Identical' here means: Please note that it doesn't compare ChannelBuffer.readerIndex() nor ChannelBuffer.writerIndex(). This method also returns false for null and an object which is not an instance of ChannelBuffer type.

Specified by:
equals in interface ChannelBuffer
Overrides:
equals in class Object

compareTo

public int compareTo(ChannelBuffer that)
Description copied from interface: ChannelBuffer
Compares the content of the specified buffer to the content of this buffer. Comparison is performed in the same manner with the string comparison functions of various languages such as strcmp, memcmp and String.compareTo(String).

Specified by:
compareTo in interface Comparable<ChannelBuffer>
Specified by:
compareTo in interface ChannelBuffer

toString

public String toString()
Description copied from interface: ChannelBuffer
Returns the string representation of this buffer. This method doesn't necessarily return the whole content of the buffer but returns the values of the key properties such as ChannelBuffer.readerIndex(), ChannelBuffer.writerIndex() and ChannelBuffer.capacity()..

Specified by:
toString in interface ChannelBuffer
Overrides:
toString in class Object

checkReadableBytes

protected void checkReadableBytes(int minimumReadableBytes)


Copyright © 2008-Present Trustin Heuiseung Lee. All Rights Reserved.