org.eclipse.jetty.io
public abstract class AbstractBuffer extends java.lang.Object implements Buffer
Buffer.CaseInsensitve
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
__IMMUTABLE |
protected static java.lang.String |
__READONLY |
protected static java.lang.String |
__READWRITE |
protected static java.lang.String |
__VOLATILE |
protected int |
_access |
protected int |
_get |
protected int |
_hash |
protected int |
_hashGet |
protected int |
_hashPut |
protected int |
_mark |
protected int |
_put |
protected java.lang.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(java.lang.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(java.io.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.
|
java.lang.String |
toDebugString() |
java.lang.String |
toDetailString() |
java.lang.String |
toString() |
java.lang.String |
toString(java.nio.charset.Charset charset) |
java.lang.String |
toString(java.lang.String charset) |
void |
writeTo(java.io.OutputStream out)
Write the buffer's contents to the output stream
|
protected static final java.lang.String __IMMUTABLE
protected static final java.lang.String __READONLY
protected static final java.lang.String __READWRITE
protected static final java.lang.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 java.lang.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 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
public void clear()
Buffer
public void compact()
Buffer
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean equalsIgnoreCase(Buffer b)
equalsIgnoreCase
in interface Buffer
boolean
value true if case sensitive comparison on this bufferpublic byte get()
Buffer
public int get(byte[] b, int offset, int length)
Buffer
public Buffer get(int length)
public final int getIndex()
Buffer
public boolean hasContent()
hasContent
in interface Buffer
public int hashCode()
hashCode
in class java.lang.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
public void mark()
Buffer
public void mark(int offset)
Buffer
public int markIndex()
Buffer
public byte peek()
Buffer
public Buffer peek(int index, int length)
public int poke(int index, Buffer src)
Buffer
public int poke(int index, byte[] b, int offset, int length)
Buffer
public int put(Buffer src)
Buffer
public void put(byte b)
Buffer
public int put(byte[] b, int offset, int length)
Buffer
public int put(byte[] b)
Buffer
public final int putIndex()
Buffer
public void reset()
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
public Buffer slice()
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
valueBuffer
value from the mark of the length requested.public int space()
Buffer
public java.lang.String toDetailString()
toDetailString
in interface Buffer
String
value describing the state and contents of the buffer.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String charset)
public java.lang.String toString(java.nio.charset.Charset charset)
public java.lang.String toDebugString()
public void writeTo(java.io.OutputStream out) throws java.io.IOException
Buffer
public int readFrom(java.io.InputStream in, int max) throws java.io.IOException
Buffer
Copyright © 2014. All Rights Reserved.