Top Description Inners Fields Constructors Methods
org.mortbay.io

public Class View

extends AbstractBuffer
Class Inheritance
Known Direct Subclasses
org.mortbay.io.View.CaseInsensitive

A View on another buffer. Allows operations that do not change the _content or indexes of the backing buffer.
Author
gregw

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
pack-priv Buffer
Inherited from org.mortbay.io.AbstractBuffer:
__IMMUTABLE__READONLY__READWRITE__VOLATILE_access_get_hash_hashGet_hashPut_mark_put_string_view_volatile

Constructor Summary

AccessConstructor and Description
public
View(Buffer
The Buffer on which we are presenting a View.
buffer
,
int
The initial value of the mark index
mark
,
int
The initial value of the get index
get
,
int
The initial value of the put index
put
,
int
The access level - one of the constants from Buffer.
access
)

public
View(Buffer buffer)

public
View()

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

The Buffer#array() from the underlying buffer.
array
()

Implements org.mortbay.io.Buffer.array.

Get the underlying array, if one exists.
public Buffer

Returns:

The Buffer#buffer() from the underlying buffer.
buffer
()

Overrides org.mortbay.io.AbstractBuffer.buffer.

Implements org.mortbay.io.Buffer.buffer.

Get the unerlying buffer.
public int

Returns:

The Buffer#capacity of the underlying buffer.
capacity
()

Implements org.mortbay.io.Buffer.capacity.

The capacity of the buffer.
public void
clear()

Overrides org.mortbay.io.AbstractBuffer.clear.

Implements org.mortbay.io.Buffer.clear.

Clear the buffer.
public void
compact()

Overrides org.mortbay.io.AbstractBuffer.compact.

Implements org.mortbay.io.Buffer.compact.

Compact the buffer by discarding bytes before the postion (or mark if set).
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides org.mortbay.io.AbstractBuffer.equals.

Indicates whether some other object is "equal to" this one.
public boolean

Returns:

Whether the underlying buffer is read only
isReadOnly
()

Overrides org.mortbay.io.AbstractBuffer.isReadOnly.

Implements org.mortbay.io.Buffer.isReadOnly.

public boolean

Returns:

Whether the underlying buffer is volatile
isVolatile
()

Overrides org.mortbay.io.AbstractBuffer.isVolatile.

Implements org.mortbay.io.Buffer.isVolatile.

public byte

Returns:

The result of calling Buffer#peek(int) on the underlying buffer
peek
(int
an int value
index
)

Implements org.mortbay.io.Buffer.peek.

Get the byte at a specific index in the buffer.
public int

Returns:

The result of calling Buffer#peek(int, byte[], int, int) on the underlying buffer
peek
(int
an int value
index
,
byte[]
The byte array to peek into
b
,
int
The offset into the array to start peeking
offset
,
int
an int value
length
)

Implements org.mortbay.io.Buffer.peek.

public Buffer

Returns:

The result of calling Buffer#peek(int, int) on the underlying buffer
peek
(int
an int value
index
,
int
an int value
length
)

Overrides org.mortbay.io.AbstractBuffer.peek.

Implements org.mortbay.io.Buffer.peek.

public int
poke(int index, Buffer src)

Overrides org.mortbay.io.AbstractBuffer.poke.

Implements org.mortbay.io.Buffer.poke.

Put the contents of the buffer at the specific index.
public void
poke(int index, byte b)

Implements org.mortbay.io.Buffer.poke.

Put a specific byte to a specific getIndex.
public int
poke(int index, byte[] b, int offset, int length)

Overrides org.mortbay.io.AbstractBuffer.poke.

Implements org.mortbay.io.Buffer.poke.

Put a specific byte to a specific getIndex.
public String
toString()

Overrides org.mortbay.io.AbstractBuffer.toString.

Returns a string representation of the object.
public void
update(Buffer buffer)

Update view to buffer

public void
update(int get, int put)

Inherited from org.mortbay.io.AbstractBuffer:
asArrayasImmutableBufferasMutableBufferasNonVolatileBufferasReadOnlyBufferduplicateequalsIgnoreCasegetgetgetgetIndexhasContenthashCodeisImmutablelengthmarkmarkmarkIndexpeekputputputputputIndexreadFromresetrewindsetGetIndexsetMarkIndexsetPutIndexskipslicesliceFromMarksliceFromMarkspacetoDebugStringtoDetailStringtoStringwriteTo

Field Detail

_bufferback to summary
pack-priv Buffer _buffer

Constructor Detail

Viewback to summary
public View(Buffer buffer, int mark, int get, int put, int access)
Parameters
buffer:Buffer

The Buffer on which we are presenting a View.

mark:int

The initial value of the mark index

get:int

The initial value of the get index

put:int

The initial value of the put index

access:int

The access level - one of the constants from Buffer.

Viewback to summary
public View(Buffer buffer)
Viewback to summary
public View()

Method Detail

arrayback to summary
public byte[] array()

Implements org.mortbay.io.Buffer.array.

Doc from org.mortbay.io.Buffer.array.

Get the underlying array, if one exists.

Returns:byte[]

The Buffer#array() from the underlying buffer.

bufferback to summary
public Buffer buffer()

Overrides org.mortbay.io.AbstractBuffer.buffer.

Implements org.mortbay.io.Buffer.buffer.

Doc from org.mortbay.io.Buffer.buffer.

Get the unerlying buffer. If this buffer wraps a backing buffer.

Returns:Buffer

The Buffer#buffer() from the underlying buffer.

capacityback to summary
public int capacity()

Implements org.mortbay.io.Buffer.capacity.

Doc from org.mortbay.io.Buffer.capacity.

The capacity of the buffer. This is the maximum putIndex that may be set.

Returns:int

The Buffer#capacity of the underlying buffer.

clearback to summary
public void clear()

Overrides org.mortbay.io.AbstractBuffer.clear.

Implements org.mortbay.io.Buffer.clear.

Doc from org.mortbay.io.Buffer.clear.

Clear the buffer. getIndex=0, putIndex=0.

compactback to summary
public void compact()

Overrides org.mortbay.io.AbstractBuffer.compact.

Implements org.mortbay.io.Buffer.compact.

Doc from org.mortbay.io.Buffer.compact.

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.

equalsback to summary
public boolean equals(Object obj)

Overrides org.mortbay.io.AbstractBuffer.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

isReadOnlyback to summary
public boolean isReadOnly()

Overrides org.mortbay.io.AbstractBuffer.isReadOnly.

Implements org.mortbay.io.Buffer.isReadOnly.

Returns:boolean

Whether the underlying buffer is read only

isVolatileback to summary
public boolean isVolatile()

Overrides org.mortbay.io.AbstractBuffer.isVolatile.

Implements org.mortbay.io.Buffer.isVolatile.

Returns:boolean

Whether the underlying buffer is volatile

peekback to summary
public byte peek(int index)

Implements org.mortbay.io.Buffer.peek.

Doc from org.mortbay.io.Buffer.peek.

Get the byte at a specific index in the buffer.

Parameters
index:int

an int value

Returns:byte

The result of calling Buffer#peek(int) on the underlying buffer

peekback to summary
public int peek(int index, byte[] b, int offset, int length)

Implements org.mortbay.io.Buffer.peek.

Parameters
index:int

Doc from org.mortbay.io.Buffer.peek.

an int value

b:byte[]

Doc from org.mortbay.io.Buffer.peek.

The byte array to peek into

offset:int

Doc from org.mortbay.io.Buffer.peek.

The offset into the array to start peeking

length:int

Doc from org.mortbay.io.Buffer.peek.

an int value

Returns:int

The result of calling Buffer#peek(int, byte[], int, int) on the underlying buffer

peekback to summary
public Buffer peek(int index, int length)

Overrides org.mortbay.io.AbstractBuffer.peek.

Implements org.mortbay.io.Buffer.peek.

Parameters
index:int

Doc from org.mortbay.io.Buffer.peek.

an int value

length:int

Doc from org.mortbay.io.Buffer.peek.

an int value

Returns:Buffer

The result of calling Buffer#peek(int, int) on the underlying buffer

pokeback to summary
public int poke(int index, Buffer src)

Overrides org.mortbay.io.AbstractBuffer.poke.

Implements org.mortbay.io.Buffer.poke.

Doc from org.mortbay.io.Buffer.poke.

Put the contents of the buffer at the specific index.

Returns:int

The number of bytes actually poked

pokeback to summary
public void poke(int index, byte b)

Implements org.mortbay.io.Buffer.poke.

Doc from org.mortbay.io.Buffer.poke.

Put a specific byte to a specific getIndex.

pokeback to summary
public int poke(int index, byte[] b, int offset, int length)

Overrides org.mortbay.io.AbstractBuffer.poke.

Implements org.mortbay.io.Buffer.poke.

Doc from org.mortbay.io.Buffer.poke.

Put a specific byte to a specific getIndex.

Returns:int

The number of bytes actually poked

toStringback to summary
public String toString()

Overrides org.mortbay.io.AbstractBuffer.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

updateback to summary
public void update(Buffer buffer)

Update view to buffer

updateback to summary
public void update(int get, int put)
org.mortbay.io back to summary

public Class View.CaseInsensitive

extends View
implements CaseInsensitve
Class Inheritance
All Implemented Interfaces
org.mortbay.io.Buffer.CaseInsensitve

Field Summary

Inherited from org.mortbay.io.View:
_buffer

Constructor Summary

AccessConstructor and Description
public
public
CaseInsensitive(Buffer buffer, int mark, int get, int put, int access)

public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides org.mortbay.io.View.equals.

Indicates whether some other object is "equal to" this one.
Inherited from org.mortbay.io.View:
arraybuffercapacityclearcompactisReadOnlyisVolatilepeekpeekpeekpokepokepoketoStringupdateupdate

Constructor Detail

CaseInsensitiveback to summary
public CaseInsensitive()
CaseInsensitiveback to summary
public CaseInsensitive(Buffer buffer, int mark, int get, int put, int access)
CaseInsensitiveback to summary
public CaseInsensitive(Buffer buffer)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides org.mortbay.io.View.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.