|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.io.AbstractBuffer org.mortbay.io.ByteArrayBuffer
public class ByteArrayBuffer
Nested Class Summary | |
---|---|
static class |
ByteArrayBuffer.CaseInsensitive
|
Nested classes/interfaces inherited from interface org.mortbay.io.Buffer |
---|
Buffer.CaseInsensitve |
Field Summary | |
---|---|
protected byte[] |
_bytes
|
Fields inherited from class org.mortbay.io.AbstractBuffer |
---|
__IMMUTABLE, __READONLY, __READWRITE, __VOLATILE, _access, _get, _hash, _hashGet, _hashPut, _mark, _put, _string, _view, _volatile |
Fields inherited from interface org.mortbay.io.Buffer |
---|
IMMUTABLE, NON_VOLATILE, READONLY, READWRITE, VOLATILE |
Constructor Summary | |
---|---|
|
ByteArrayBuffer(byte[] bytes)
|
|
ByteArrayBuffer(byte[] bytes,
int index,
int length)
|
|
ByteArrayBuffer(byte[] bytes,
int index,
int length,
int access)
|
|
ByteArrayBuffer(byte[] bytes,
int index,
int length,
int access,
boolean isVolatile)
|
|
ByteArrayBuffer(int size)
|
protected |
ByteArrayBuffer(int access,
boolean isVolatile)
|
|
ByteArrayBuffer(String value)
|
|
ByteArrayBuffer(String value,
String encoding)
|
Method Summary | |
---|---|
byte[] |
array()
Get the underlying array, if one exists. |
int |
capacity()
The capacity of the buffer. |
void |
compact()
Compact the buffer by discarding bytes before the postion (or mark if set). |
boolean |
equals(Object obj)
|
boolean |
equalsIgnoreCase(Buffer b)
|
byte |
get()
Get the byte at the current getIndex and increment it. |
int |
hashCode()
|
byte |
peek(int index)
Get the byte at a specific index in the buffer. |
int |
peek(int index,
byte[] b,
int offset,
int length)
|
int |
poke(int index,
Buffer src)
Put the contents of the buffer at the specific index. |
void |
poke(int index,
byte b)
Put a specific byte to a specific getIndex. |
int |
poke(int index,
byte[] b,
int offset,
int length)
Put a specific byte to a specific getIndex. |
int |
readFrom(InputStream in,
int max)
Read the buffer's contents from the input stream |
int |
space()
the space remaining in the buffer. |
void |
wrap(byte[] b)
Wrap a byte array |
void |
wrap(byte[] b,
int off,
int len)
Wrap a byte array. |
void |
writeTo(OutputStream out)
Write the buffer's contents to the output stream |
Methods inherited from class org.mortbay.io.AbstractBuffer |
---|
asArray, asImmutableBuffer, asMutableBuffer, asNonVolatileBuffer, asReadOnlyBuffer, buffer, clear, duplicate, get, get, getIndex, hasContent, isImmutable, isReadOnly, isVolatile, length, mark, mark, markIndex, peek, peek, put, put, put, put, putIndex, reset, rewind, setGetIndex, setMarkIndex, setPutIndex, skip, slice, sliceFromMark, sliceFromMark, toDebugString, toDetailString, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected byte[] _bytes
Constructor Detail |
---|
protected ByteArrayBuffer(int access, boolean isVolatile)
public ByteArrayBuffer(byte[] bytes)
public ByteArrayBuffer(byte[] bytes, int index, int length)
public ByteArrayBuffer(byte[] bytes, int index, int length, int access)
public ByteArrayBuffer(byte[] bytes, int index, int length, int access, boolean isVolatile)
public ByteArrayBuffer(int size)
public ByteArrayBuffer(String value)
public ByteArrayBuffer(String value, String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException
Method Detail |
---|
public byte[] array()
Buffer
byte[]
backing this buffer or null if none exists.public int capacity()
Buffer
int
valuepublic void compact()
Buffer
compact
in interface Buffer
compact
in class AbstractBuffer
public boolean equals(Object obj)
equals
in class AbstractBuffer
public boolean equalsIgnoreCase(Buffer b)
equalsIgnoreCase
in interface Buffer
equalsIgnoreCase
in class AbstractBuffer
boolean
value true if case sensitive comparison on this bufferpublic byte get()
Buffer
get
in interface Buffer
get
in class AbstractBuffer
byte
value from the current getIndex.public int hashCode()
hashCode
in class AbstractBuffer
public byte peek(int index)
Buffer
index
- an int
value
byte
valuepublic int peek(int index, byte[] b, int offset, int length)
index
- an int
valueb
- The byte array to peek intooffset
- The offset into the array to start peekinglength
- an int
value
public void poke(int index, byte b)
Buffer
index
- an int
valueb
- a byte
valuepublic int poke(int index, Buffer src)
Buffer
poke
in interface Buffer
poke
in class AbstractBuffer
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
poke
in class AbstractBuffer
index
- an int
valueb
- a byte array
value
public void wrap(byte[] b, int off, int len)
b
- off
- len
- public void wrap(byte[] b)
b
- public void writeTo(OutputStream out) throws IOException
Buffer
writeTo
in interface Buffer
writeTo
in class AbstractBuffer
IOException
public int readFrom(InputStream in, int max) throws IOException
Buffer
readFrom
in interface Buffer
readFrom
in class AbstractBuffer
in
- input streammax
- maximum number of bytes that may be read
IOException
public int space()
Buffer
space
in interface Buffer
space
in class AbstractBuffer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |