|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.io.AbstractBuffer
public abstract class AbstractBuffer
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.mortbay.io.Buffer |
---|
Buffer.CaseInsensitve |
Field Summary | |
---|---|
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
|
private int |
_hashGet
|
private int |
_hashPut
|
private int |
_mark
|
protected int |
_put
|
protected String |
_string
|
private View |
_view
|
protected boolean |
_volatile
|
Fields inherited from interface org.mortbay.io.Buffer |
---|
IMMUTABLE, NON_VOLATILE, READONLY, READWRITE, VOLATILE |
Constructor Summary | |
---|---|
AbstractBuffer(int access,
boolean isVolatile)
Constructor for BufferView |
Method Summary | |
---|---|
byte[] |
asArray()
|
Buffer |
asImmutableBuffer()
|
Buffer |
asMutableBuffer()
|
Buffer |
asNonVolatileBuffer()
|
Buffer |
asReadOnlyBuffer()
|
Buffer |
buffer()
Get the unerlying 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. |
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 |
toDetailString()
|
String |
toString()
|
void |
writeTo(OutputStream out)
Write the buffer's contents to the output stream |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mortbay.io.Buffer |
---|
array, capacity, peek, peek, poke |
Field Detail |
---|
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
private int _hashGet
private int _hashPut
private int _mark
protected String _string
private View _view
Constructor Detail |
---|
public AbstractBuffer(int access, boolean isVolatile)
access
- 0==IMMUTABLE, 1==READONLY, 2==READWRITEMethod Detail |
---|
public byte[] asArray()
asArray
in interface Buffer
byte[]
value of the bytes from the getIndex to the putIndex.public ByteArrayBuffer duplicate(int access)
public Buffer asNonVolatileBuffer()
asNonVolatileBuffer
in interface Buffer
Buffer
valuepublic Buffer asImmutableBuffer()
asImmutableBuffer
in interface Buffer
Buffer
.public Buffer asReadOnlyBuffer()
asReadOnlyBuffer
in interface Buffer
Buffer
.public Buffer asMutableBuffer()
asMutableBuffer
in interface Buffer
Buffer
.public Buffer buffer()
Buffer
buffer
in interface Buffer
public void clear()
Buffer
clear
in interface Buffer
public void compact()
Buffer
compact
in interface Buffer
public boolean equals(Object obj)
equals
in class Object
public boolean equalsIgnoreCase(Buffer b)
equalsIgnoreCase
in interface Buffer
boolean
value true if case sensitive comparison on this bufferpublic byte get()
Buffer
get
in interface Buffer
byte
value from the current getIndex.public int get(byte[] b, int offset, int length)
Buffer
get
in interface Buffer
b
- The byte array to fill.offset
- Offset in the array.length
- The max number of bytes to read.
public Buffer get(int length)
get
in interface Buffer
length
- an int
value
Buffer
valuepublic final int getIndex()
Buffer
getIndex
in interface Buffer
int
value >=0 <= putIndex()public boolean hasContent()
hasContent
in interface Buffer
public int hashCode()
hashCode
in class Object
public boolean isImmutable()
isImmutable
in interface Buffer
boolean
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 Buffer
boolean
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 Buffer
boolean
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()
Buffer
length
in interface Buffer
int
== putIndex()-getIndex()public void mark()
Buffer
mark
in interface Buffer
public void mark(int offset)
Buffer
mark
in interface Buffer
offset
- an int
value to add to the current getIndex to obtain the mark value.public int markIndex()
Buffer
markIndex
in interface Buffer
int
index in the buffer or -1 if the mark is not set.public byte peek()
Buffer
peek
in interface Buffer
byte
value from the current getIndex.public Buffer peek(int index, int length)
peek
in interface Buffer
index
- an int
valuelength
- an int
value
Buffer
value from the requested getIndex.public int poke(int index, Buffer src)
Buffer
poke
in interface Buffer
index
- an int
valuesrc
- a Buffer
. If the source buffer is not modified
public int poke(int index, byte[] b, int offset, int length)
Buffer
poke
in interface Buffer
index
- an int
valueb
- a byte array
value
public int put(Buffer src)
Buffer
put
in interface Buffer
src
- The source Buffer
it is not modified.
public void put(byte b)
Buffer
put
in interface Buffer
b
- a byte
valuepublic int put(byte[] b, int offset, int length)
Buffer
put
in interface Buffer
b
- a byte
value
public int put(byte[] b)
Buffer
put
in interface Buffer
b
- a byte
value
public final int putIndex()
Buffer
putIndex
in interface Buffer
int
value >= getIndex()public void reset()
Buffer
reset
in interface Buffer
public void rewind()
public void setGetIndex(int getIndex)
Buffer
setGetIndex
in interface Buffer
getIndex
- an int
valuepublic void setMarkIndex(int index)
Buffer
setMarkIndex
in interface Buffer
index
- an int
valuepublic void setPutIndex(int putIndex)
setPutIndex
in interface Buffer
putIndex
- an int
valuepublic int skip(int n)
Buffer
skip
in interface Buffer
n
- The number of bytes to skip
public Buffer slice()
slice
in interface Buffer
Buffer
from the postion to the putIndex.public Buffer sliceFromMark()
sliceFromMark
in interface Buffer
Buffer
value from the mark to the putIndexpublic Buffer sliceFromMark(int length)
sliceFromMark
in interface Buffer
length
- an int
value
Buffer
value from the mark of the length requested.public int space()
Buffer
space
in interface Buffer
public String toDetailString()
toDetailString
in interface Buffer
String
value describing the state and contents of the buffer.public String toString()
toString
in class Object
public void writeTo(OutputStream out) throws IOException
Buffer
writeTo
in interface Buffer
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |