public abstract class AbstractBuffer extends Object implements Buffer
Buffer.CaseInsensitve| Modifier and Type | Field and Description |
|---|---|
protected static String |
__IMMUTABLE |
protected static String |
__READONLY |
protected static String |
__READWRITE |
protected static String |
__VOLATILE |
protected int |
_access |
protected int |
_get |
protected int |
_hash |
protected int |
_hashGet |
protected int |
_hashPut |
protected int |
_mark |
protected int |
_put |
protected String |
_string |
protected View |
_view |
protected boolean |
_volatile |
| Constructor and Description |
|---|
AbstractBuffer(int access,
boolean isVolatile)
Constructor for BufferView
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asArray() |
Buffer |
asImmutableBuffer() |
Buffer |
asMutableBuffer() |
Buffer |
asNonVolatileBuffer() |
Buffer |
asReadOnlyBuffer() |
Buffer |
buffer()
Get the underlying buffer.
|
void |
clear()
Clear the buffer.
|
void |
compact()
Compact the buffer by discarding bytes before the postion (or mark if set).
|
ByteArrayBuffer |
duplicate(int access) |
boolean |
equals(Object obj) |
boolean |
equalsIgnoreCase(Buffer b) |
byte |
get()
Get the byte at the current getIndex and increment it.
|
int |
get(byte[] b,
int offset,
int length)
Get bytes from the current postion and put them into the passed byte array.
|
Buffer |
get(int length) |
int |
getIndex()
The index within the buffer that will next be read or written.
|
boolean |
hasContent() |
int |
hashCode() |
boolean |
isImmutable() |
boolean |
isReadOnly() |
boolean |
isVolatile() |
int |
length()
The number of bytes from the getIndex to the putIndex
|
void |
mark()
Set the mark to the current getIndex.
|
void |
mark(int offset)
Set the mark relative to the current getIndex
|
int |
markIndex()
The current index of the mark.
|
byte |
peek()
Get the byte at the current getIndex without incrementing the getIndex.
|
Buffer |
peek(int index,
int length) |
int |
poke(int index,
Buffer src)
Put the contents of the buffer at the specific index.
|
int |
poke(int index,
byte[] b,
int offset,
int length)
Put a specific byte to a specific getIndex.
|
int |
put(Buffer src)
Write the bytes from the source buffer to the current getIndex.
|
void |
put(byte b)
Put a byte to the current getIndex and increment the getIndex.
|
int |
put(byte[] b)
Put a byte to the current getIndex and increment the getIndex.
|
int |
put(byte[] b,
int offset,
int length)
Put a byte to the current getIndex and increment the getIndex.
|
int |
putIndex()
The index of the first element that should not be read.
|
int |
readFrom(InputStream in,
int max)
Read the buffer's contents from the input stream
|
void |
reset()
Reset the current getIndex to the mark
|
void |
rewind() |
void |
setGetIndex(int getIndex)
Set the buffers start getIndex.
|
void |
setMarkIndex(int index)
Set a specific value for the mark.
|
void |
setPutIndex(int putIndex) |
int |
skip(int n)
Skip _content.
|
Buffer |
slice() |
Buffer |
sliceFromMark() |
Buffer |
sliceFromMark(int length) |
int |
space()
the space remaining in the buffer.
|
String |
toDebugString() |
String |
toDetailString() |
String |
toString() |
String |
toString(Charset charset) |
String |
toString(String charset) |
void |
writeTo(OutputStream out)
Write the buffer's contents to the output stream
|
protected static final String __IMMUTABLE
protected static final String __READONLY
protected static final String __READWRITE
protected static final String __VOLATILE
protected int _access
protected boolean _volatile
protected int _get
protected int _put
protected int _hash
protected int _hashGet
protected int _hashPut
protected int _mark
protected String _string
protected View _view
public AbstractBuffer(int access,
boolean isVolatile)
access - 0==IMMUTABLE, 1==READONLY, 2==READWRITEpublic byte[] asArray()
public ByteArrayBuffer duplicate(int access)
public Buffer asNonVolatileBuffer()
asNonVolatileBuffer in interface BufferBuffer valuepublic Buffer asImmutableBuffer()
asImmutableBuffer in interface BufferBuffer.public Buffer asReadOnlyBuffer()
asReadOnlyBuffer in interface BufferBuffer.public Buffer asMutableBuffer()
asMutableBuffer in interface BufferBuffer.public Buffer buffer()
Bufferpublic void clear()
Bufferpublic void compact()
Bufferpublic boolean equalsIgnoreCase(Buffer b)
equalsIgnoreCase in interface Bufferboolean value true if case sensitive comparison on this bufferpublic byte get()
Bufferpublic int get(byte[] b,
int offset,
int length)
Bufferpublic Buffer get(int length)
public final int getIndex()
Bufferpublic boolean hasContent()
hasContent in interface Bufferpublic boolean isImmutable()
isImmutable in interface Bufferboolean value true if the buffer is immutable and that neither
the buffer contents nor the indexes may be changed.public boolean isReadOnly()
isReadOnly in interface Bufferboolean value true if the buffer is readonly. The buffer indexes may
be modified, but the buffer contents may not. For example a View onto an immutable Buffer will be
read only.public boolean isVolatile()
isVolatile in interface Bufferboolean value true if the buffer contents may change
via alternate paths than this buffer. If the contents of this buffer are to be used outside of the
current context, then a copy must be made.public int length()
Bufferpublic void mark()
Bufferpublic void mark(int offset)
Bufferpublic int markIndex()
Bufferpublic byte peek()
Bufferpublic Buffer peek(int index, int length)
public int poke(int index,
Buffer src)
Bufferpublic int poke(int index,
byte[] b,
int offset,
int length)
Bufferpublic int put(Buffer src)
Bufferpublic void put(byte b)
Bufferpublic int put(byte[] b,
int offset,
int length)
Bufferpublic int put(byte[] b)
Bufferpublic final int putIndex()
Bufferpublic void reset()
Bufferpublic void rewind()
public void setGetIndex(int getIndex)
BuffersetGetIndex in interface BuffergetIndex - an int valuepublic void setMarkIndex(int index)
BuffersetMarkIndex in interface Bufferindex - an int valuepublic void setPutIndex(int putIndex)
setPutIndex in interface BufferputIndex - an int valuepublic int skip(int n)
Bufferpublic Buffer slice()
public Buffer sliceFromMark()
sliceFromMark in interface BufferBuffer value from the mark to the putIndexpublic Buffer sliceFromMark(int length)
sliceFromMark in interface Bufferlength - an int valueBuffer value from the mark of the length requested.public int space()
Bufferpublic String toDetailString()
toDetailString in interface BufferString value describing the state and contents of the buffer.public String toDebugString()
public void writeTo(OutputStream out) throws IOException
BufferwriteTo in interface BufferIOExceptionpublic int readFrom(InputStream in, int max) throws IOException
BufferreadFrom in interface Bufferin - input streammax - maximum number of bytes that may be readIOExceptionCopyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.