Top Description Fields Constructors Methods
org.apache.tomcat.util.buf

public abstract Class AbstractChunk

extends Object
implements Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable
Known Direct Subclasses
org.apache.tomcat.util.buf.ByteChunk, org.apache.tomcat.util.buf.CharChunk
Imports
java.io.Serializable, org.apache.tomcat.util.res.StringManager

Base class for the *Chunk implementation to reduce duplication.

Field Summary

Modifier and TypeField and Description
public static final int
protected int
protected boolean
private int
protected boolean
private int
private static final long
protected static final StringManager
protected int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract int
getBufferElement(int index)

public int
public int

Returns:

the length of the data in the buffer
getLength
()

public int
protected int
public int
public int

Returns:

the start position of the data in the buffer
getStart
()

public int
hash()

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public int
indexOf(String src, int srcOff, int srcLen, int myOff)

public boolean
public void
recycle()

Resets the chunk to an uninitialized state.

public void
setEnd(int i)

public void
setLimit(int
The new limit
limit
)

Maximum amount of data in this buffer.

public void
setOffset(int off)

Inherited from java.lang.Object:
cloneequalsfinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

ARRAY_MAX_SIZEback to summary
public static final int ARRAY_MAX_SIZE
endback to summary
protected int end
hasHashCodeback to summary
protected boolean hasHashCode
hashCodeback to summary
private int hashCode
isSetback to summary
protected boolean isSet
limitback to summary
private int limit
serialVersionUIDback to summary
private static final long serialVersionUID
smback to summary
protected static final StringManager sm
startback to summary
protected int start

Constructor Detail

AbstractChunkback to summary
public AbstractChunk()

Method Detail

getBufferElementback to summary
protected abstract int getBufferElement(int index)
getEndback to summary
public int getEnd()
getLengthback to summary
public int getLength()
Returns:int

the length of the data in the buffer

getLimitback to summary
public int getLimit()
getLimitInternalback to summary
protected int getLimitInternal()
getOffsetback to summary
public int getOffset()
getStartback to summary
public int getStart()
Returns:int

the start position of the data in the buffer

hashback to summary
public int hash()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
indexOfback to summary
public int indexOf(String src, int srcOff, int srcLen, int myOff)
isNullback to summary
public boolean isNull()
recycleback to summary
public void recycle()

Resets the chunk to an uninitialized state.

setEndback to summary
public void setEnd(int i)
setLimitback to summary
public void setLimit(int limit)

Maximum amount of data in this buffer. If -1 or not set, the buffer will grow to {ARRAY_MAX_SIZE. Can be smaller than the current buffer size ( which will not shrink ). When the limit is reached, the buffer will be flushed (if out is set) or throw exception.

Parameters
limit:int

The new limit

setOffsetback to summary
public void setOffset(int off)