Package org.jboss.netty.buffer
Class LittleEndianHeapChannelBuffer
- java.lang.Object
-
- org.jboss.netty.buffer.AbstractChannelBuffer
-
- org.jboss.netty.buffer.HeapChannelBuffer
-
- org.jboss.netty.buffer.LittleEndianHeapChannelBuffer
-
- All Implemented Interfaces:
java.lang.Comparable<ChannelBuffer>,ChannelBuffer
public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer
A little-endian Java heap buffer. It is recommended to useChannelBuffers.buffer(ByteOrder, int)andChannelBuffers.wrappedBuffer(ByteOrder, byte[])instead of calling the constructor explicitly.
-
-
Field Summary
-
Fields inherited from class org.jboss.netty.buffer.HeapChannelBuffer
array
-
-
Constructor Summary
Constructors Modifier Constructor Description LittleEndianHeapChannelBuffer(byte[] array)Creates a new little-endian heap buffer with an existing byte array.privateLittleEndianHeapChannelBuffer(byte[] array, int readerIndex, int writerIndex)LittleEndianHeapChannelBuffer(int length)Creates a new little-endian heap buffer with a newly allocated byte array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelBuffercopy(int index, int length)Returns a copy of this buffer's sub-region.ChannelBufferduplicate()Returns a buffer which shares the whole region of this buffer.ChannelBufferFactoryfactory()Returns the factory which creates aChannelBufferwhose type and defaultByteOrderare same with this buffer.intgetInt(int index)Gets a 32-bit integer at the specified absoluteindexin this buffer.longgetLong(int index)Gets a 64-bit long integer at the specified absoluteindexin this buffer.shortgetShort(int index)Gets a 16-bit short integer at the specified absoluteindexin this buffer.intgetUnsignedMedium(int index)Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer.java.nio.ByteOrderorder()Returns the endianness of this buffer.voidsetInt(int index, int value)Sets the specified 32-bit integer at the specified absoluteindexin this buffer.voidsetLong(int index, long value)Sets the specified 64-bit long integer at the specified absoluteindexin this buffer.voidsetMedium(int index, int value)Sets the specified 24-bit medium integer at the specified absoluteindexin this buffer.voidsetShort(int index, int value)Sets the specified 16-bit short integer at the specified absoluteindexin this buffer.-
Methods inherited from class org.jboss.netty.buffer.HeapChannelBuffer
array, arrayOffset, capacity, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, hasArray, isDirect, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, slice, toByteBuffer
-
Methods inherited from class org.jboss.netty.buffer.AbstractChannelBuffer
bytesBefore, bytesBefore, bytesBefore, bytesBefore, bytesBefore, bytesBefore, checkReadableBytes, clear, compareTo, copy, discardReadBytes, ensureWritableBytes, equals, getBytes, getBytes, getBytes, getChar, getDouble, getFloat, getMedium, getUnsignedByte, getUnsignedInt, getUnsignedShort, hashCode, indexOf, indexOf, markReaderIndex, markWriterIndex, readable, readableBytes, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readDouble, readerIndex, readerIndex, readFloat, readInt, readLong, readMedium, readShort, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedMedium, readUnsignedShort, resetReaderIndex, resetWriterIndex, setBytes, setBytes, setBytes, setChar, setDouble, setFloat, setIndex, setZero, skipBytes, slice, toByteBuffer, toByteBuffers, toByteBuffers, toString, toString, toString, writable, writableBytes, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeMedium, writerIndex, writerIndex, writeShort, writeZero
-
-
-
-
Constructor Detail
-
LittleEndianHeapChannelBuffer
public LittleEndianHeapChannelBuffer(int length)
Creates a new little-endian heap buffer with a newly allocated byte array.- Parameters:
length- the length of the new byte array
-
LittleEndianHeapChannelBuffer
public LittleEndianHeapChannelBuffer(byte[] array)
Creates a new little-endian heap buffer with an existing byte array.- Parameters:
array- the byte array to wrap
-
LittleEndianHeapChannelBuffer
private LittleEndianHeapChannelBuffer(byte[] array, int readerIndex, int writerIndex)
-
-
Method Detail
-
factory
public ChannelBufferFactory factory()
Description copied from interface:ChannelBufferReturns the factory which creates aChannelBufferwhose type and defaultByteOrderare same with this buffer.
-
order
public java.nio.ByteOrder order()
Description copied from interface:ChannelBufferReturns the endianness of this buffer.
-
getShort
public short getShort(int index)
Description copied from interface:ChannelBufferGets a 16-bit short integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
getUnsignedMedium
public int getUnsignedMedium(int index)
Description copied from interface:ChannelBufferGets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
getInt
public int getInt(int index)
Description copied from interface:ChannelBufferGets a 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
getLong
public long getLong(int index)
Description copied from interface:ChannelBufferGets a 64-bit long integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
setShort
public void setShort(int index, int value)Description copied from interface:ChannelBufferSets the specified 16-bit short integer at the specified absoluteindexin this buffer. The 16 high-order bits of the specified value are ignored. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
setMedium
public void setMedium(int index, int value)Description copied from interface:ChannelBufferSets the specified 24-bit medium integer at the specified absoluteindexin this buffer. Please note that the most significant byte is ignored in the specified value. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
setInt
public void setInt(int index, int value)Description copied from interface:ChannelBufferSets the specified 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
setLong
public void setLong(int index, long value)Description copied from interface:ChannelBufferSets the specified 64-bit long integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
duplicate
public ChannelBuffer duplicate()
Description copied from interface:ChannelBufferReturns a buffer which shares the whole region of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical tobuf.slice(0, buf.capacity()). This method does not modifyreaderIndexorwriterIndexof this buffer.
-
copy
public ChannelBuffer copy(int index, int length)
Description copied from interface:ChannelBufferReturns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method does not modifyreaderIndexorwriterIndexof this buffer.
-
-