org.eclipse.jetty.io
类 AbstractBuffer

java.lang.Object
  继承者 org.eclipse.jetty.io.AbstractBuffer
所有已实现的接口:
Cloneable, Buffer
直接已知子类:
ByteArrayBuffer, DirectNIOBuffer, RandomAccessFileBuffer, View

public abstract class AbstractBuffer
extends Object
implements Buffer


嵌套类摘要
 
从接口 org.eclipse.jetty.io.Buffer 继承的嵌套类/接口
Buffer.CaseInsensitve
 
字段摘要
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
           
 
从接口 org.eclipse.jetty.io.Buffer 继承的字段
IMMUTABLE, NON_VOLATILE, READONLY, READWRITE, VOLATILE
 
构造方法摘要
AbstractBuffer(int access, boolean isVolatile)
          Constructor for BufferView
 
方法摘要
 byte[] asArray()
           
 Buffer asImmutableBuffer()
           
 Buffer asMutableBuffer()
           
 Buffer asNonVolatileBuffer()
           
 Buffer asReadOnlyBuffer()
           
 Buffer buffer()
          Get the underlying buffer.
 void clear()
          Clear the buffer. getIndex=0, putIndex=0.
 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
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
从接口 org.eclipse.jetty.io.Buffer 继承的方法
array, capacity, peek, peek, poke
 

字段详细信息

__IMMUTABLE

protected static final String __IMMUTABLE
另请参见:
常量字段值

__READONLY

protected static final String __READONLY
另请参见:
常量字段值

__READWRITE

protected static final String __READWRITE
另请参见:
常量字段值

__VOLATILE

protected static final String __VOLATILE
另请参见:
常量字段值

_access

protected int _access

_volatile

protected boolean _volatile

_get

protected int _get

_put

protected int _put

_hash

protected int _hash

_hashGet

protected int _hashGet

_hashPut

protected int _hashPut

_mark

protected int _mark

_string

protected String _string

_view

protected View _view
构造方法详细信息

AbstractBuffer

public AbstractBuffer(int access,
                      boolean isVolatile)
Constructor for BufferView

参数:
access - 0==IMMUTABLE, 1==READONLY, 2==READWRITE
方法详细信息

asArray

public byte[] asArray()
指定者:
接口 Buffer 中的 asArray
返回:
a byte[] value of the bytes from the getIndex to the putIndex.

duplicate

public ByteArrayBuffer duplicate(int access)

asNonVolatileBuffer

public Buffer asNonVolatileBuffer()
指定者:
接口 Buffer 中的 asNonVolatileBuffer
返回:
a non volatile version of this Buffer value

asImmutableBuffer

public Buffer asImmutableBuffer()
指定者:
接口 Buffer 中的 asImmutableBuffer
返回:
an immutable version of this Buffer.

asReadOnlyBuffer

public Buffer asReadOnlyBuffer()
指定者:
接口 Buffer 中的 asReadOnlyBuffer
返回:
a readonly version of this Buffer.

asMutableBuffer

public Buffer asMutableBuffer()
指定者:
接口 Buffer 中的 asMutableBuffer
返回:
an immutable version of this Buffer.

buffer

public Buffer buffer()
从接口 Buffer 复制的描述
Get the underlying buffer. If this buffer wraps a backing buffer.

指定者:
接口 Buffer 中的 buffer
返回:
The root backing buffer or this if there is no backing buffer;

clear

public void clear()
从接口 Buffer 复制的描述
Clear the buffer. getIndex=0, putIndex=0.

指定者:
接口 Buffer 中的 clear

compact

public void compact()
从接口 Buffer 复制的描述
Compact the buffer by discarding bytes before the postion (or mark if set). Bytes from the getIndex (or mark) to the putIndex are moved to the beginning of the buffer and the values adjusted accordingly.

指定者:
接口 Buffer 中的 compact

equals

public boolean equals(Object obj)
覆盖:
Object 中的 equals

equalsIgnoreCase

public boolean equalsIgnoreCase(Buffer b)
指定者:
接口 Buffer 中的 equalsIgnoreCase
返回:
a boolean value true if case sensitive comparison on this buffer

get

public byte get()
从接口 Buffer 复制的描述
Get the byte at the current getIndex and increment it.

指定者:
接口 Buffer 中的 get
返回:
The byte value from the current getIndex.

get

public int get(byte[] b,
               int offset,
               int length)
从接口 Buffer 复制的描述
Get bytes from the current postion and put them into the passed byte array. The getIndex is incremented by the number of bytes copied into the array.

指定者:
接口 Buffer 中的 get
参数:
b - The byte array to fill.
offset - Offset in the array.
length - The max number of bytes to read.
返回:
The number of bytes actually read.

get

public Buffer get(int length)
指定者:
接口 Buffer 中的 get
参数:
length - an int value
返回:
a Buffer value

getIndex

public final int getIndex()
从接口 Buffer 复制的描述
The index within the buffer that will next be read or written.

指定者:
接口 Buffer 中的 getIndex
返回:
an int value >=0 <= putIndex()

hasContent

public boolean hasContent()
指定者:
接口 Buffer 中的 hasContent
返回:
true of putIndex > getIndex

hashCode

public int hashCode()
覆盖:
Object 中的 hashCode

isImmutable

public boolean isImmutable()
指定者:
接口 Buffer 中的 isImmutable
返回:
a boolean value true if the buffer is immutable and that neither the buffer contents nor the indexes may be changed.

isReadOnly

public boolean isReadOnly()
指定者:
接口 Buffer 中的 isReadOnly
返回:
a 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.

isVolatile

public boolean isVolatile()
指定者:
接口 Buffer 中的 isVolatile
返回:
a 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.

length

public int length()
从接口 Buffer 复制的描述
The number of bytes from the getIndex to the putIndex

指定者:
接口 Buffer 中的 length
返回:
an int == putIndex()-getIndex()

mark

public void mark()
从接口 Buffer 复制的描述
Set the mark to the current getIndex.

指定者:
接口 Buffer 中的 mark

mark

public void mark(int offset)
从接口 Buffer 复制的描述
Set the mark relative to the current getIndex

指定者:
接口 Buffer 中的 mark
参数:
offset - an int value to add to the current getIndex to obtain the mark value.

markIndex

public int markIndex()
从接口 Buffer 复制的描述
The current index of the mark.

指定者:
接口 Buffer 中的 markIndex
返回:
an int index in the buffer or -1 if the mark is not set.

peek

public byte peek()
从接口 Buffer 复制的描述
Get the byte at the current getIndex without incrementing the getIndex.

指定者:
接口 Buffer 中的 peek
返回:
The byte value from the current getIndex.

peek

public Buffer peek(int index,
                   int length)
指定者:
接口 Buffer 中的 peek
参数:
index - an int value
length - an int value
返回:
The Buffer value from the requested getIndex.

poke

public int poke(int index,
                Buffer src)
从接口 Buffer 复制的描述
Put the contents of the buffer at the specific index.

指定者:
接口 Buffer 中的 poke
参数:
index - an int value
src - a Buffer. If the source buffer is not modified
返回:
The number of bytes actually poked

poke

public int poke(int index,
                byte[] b,
                int offset,
                int length)
从接口 Buffer 复制的描述
Put a specific byte to a specific getIndex.

指定者:
接口 Buffer 中的 poke
参数:
index - an int value
b - a byte array value
返回:
The number of bytes actually poked

put

public int put(Buffer src)
从接口 Buffer 复制的描述
Write the bytes from the source buffer to the current getIndex.

指定者:
接口 Buffer 中的 put
参数:
src - The source Buffer it is not modified.
返回:
The number of bytes actually poked

put

public void put(byte b)
从接口 Buffer 复制的描述
Put a byte to the current getIndex and increment the getIndex.

指定者:
接口 Buffer 中的 put
参数:
b - a byte value

put

public int put(byte[] b,
               int offset,
               int length)
从接口 Buffer 复制的描述
Put a byte to the current getIndex and increment the getIndex.

指定者:
接口 Buffer 中的 put
参数:
b - a byte value
返回:
The number of bytes actually poked

put

public int put(byte[] b)
从接口 Buffer 复制的描述
Put a byte to the current getIndex and increment the getIndex.

指定者:
接口 Buffer 中的 put
参数:
b - a byte value
返回:
The number of bytes actually poked

putIndex

public final int putIndex()
从接口 Buffer 复制的描述
The index of the first element that should not be read.

指定者:
接口 Buffer 中的 putIndex
返回:
an int value >= getIndex()

reset

public void reset()
从接口 Buffer 复制的描述
Reset the current getIndex to the mark

指定者:
接口 Buffer 中的 reset

rewind

public void rewind()

setGetIndex

public void setGetIndex(int getIndex)
从接口 Buffer 复制的描述
Set the buffers start getIndex.

指定者:
接口 Buffer 中的 setGetIndex
参数:
getIndex - an int value

setMarkIndex

public void setMarkIndex(int index)
从接口 Buffer 复制的描述
Set a specific value for the mark.

指定者:
接口 Buffer 中的 setMarkIndex
参数:
index - an int value

setPutIndex

public void setPutIndex(int putIndex)
指定者:
接口 Buffer 中的 setPutIndex
参数:
putIndex - an int value

skip

public int skip(int n)
从接口 Buffer 复制的描述
Skip _content. The getIndex is updated by min(remaining(), n)

指定者:
接口 Buffer 中的 skip
参数:
n - The number of bytes to skip
返回:
the number of bytes skipped.

slice

public Buffer slice()
指定者:
接口 Buffer 中的 slice
返回:
a volitile Buffer from the postion to the putIndex.

sliceFromMark

public Buffer sliceFromMark()
指定者:
接口 Buffer 中的 sliceFromMark
返回:
a volitile Buffer value from the mark to the putIndex

sliceFromMark

public Buffer sliceFromMark(int length)
指定者:
接口 Buffer 中的 sliceFromMark
参数:
length - an int value
返回:
a valitile Buffer value from the mark of the length requested.

space

public int space()
从接口 Buffer 复制的描述
the space remaining in the buffer.

指定者:
接口 Buffer 中的 space
返回:
capacity - putIndex

toDetailString

public String toDetailString()
指定者:
接口 Buffer 中的 toDetailString
返回:
a String value describing the state and contents of the buffer.

toString

public String toString()
覆盖:
Object 中的 toString

toString

public String toString(String charset)
指定者:
接口 Buffer 中的 toString

toString

public String toString(Charset charset)
指定者:
接口 Buffer 中的 toString

toDebugString

public String toDebugString()

writeTo

public void writeTo(OutputStream out)
             throws IOException
从接口 Buffer 复制的描述
Write the buffer's contents to the output stream

指定者:
接口 Buffer 中的 writeTo
抛出:
IOException

readFrom

public int readFrom(InputStream in,
                    int max)
             throws IOException
从接口 Buffer 复制的描述
Read the buffer's contents from the input stream

指定者:
接口 Buffer 中的 readFrom
参数:
in - input stream
max - maximum number of bytes that may be read
返回:
actual number of bytes read or -1 for EOF
抛出:
IOException


Copyright © 2013. All Rights Reserved.