Class AbstractChunk
java.lang.Object
org.apache.tomcat.util.buf.AbstractChunk
- All Implemented Interfaces:
- Serializable,- Cloneable
Base class for the *Chunk implementation to reduce duplication.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intprotected intprotected booleanprotected booleanprotected static final StringManagerprotected int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract intgetBufferElement(int index) intgetEnd()intintgetLimit()protected intintDeprecated.Unused.intgetStart()inthash()inthashCode()intReturn the index of the first occurrence of the subsequence of the given String, or -1 if it is not found.booleanisNull()voidrecycle()Resets the chunk to an uninitialized state.voidsetEnd(int end) Set the end position of the data in the buffer.voidsetLimit(int limit) Maximum amount of data in this buffer.voidsetOffset(int off) Deprecated.Unused.voidsetStart(int start) Set the start position of the data in the buffer.
- 
Field Details- 
sm
- 
ARRAY_MAX_SIZEpublic static final int ARRAY_MAX_SIZE- See Also:
 
- 
hasHashCodeprotected boolean hasHashCode
- 
isSetprotected boolean isSet
- 
startprotected int start
- 
endprotected int end
 
- 
- 
Constructor Details- 
AbstractChunkpublic AbstractChunk()
 
- 
- 
Method Details- 
setLimitpublic 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- The new limit
 
- 
getLimitpublic int getLimit()- Returns:
- the maximum amount of data in the buffer, and -1 if it has not been set
 
- 
getLimitInternalprotected int getLimitInternal()
- 
getStartpublic int getStart()- Returns:
- the start position of the data in the buffer
 
- 
setStartpublic void setStart(int start) Set the start position of the data in the buffer.- Parameters:
- start- the new start position
 
- 
getEndpublic int getEnd()- Returns:
- the end position of the data in the buffer
 
- 
setEndpublic void setEnd(int end) Set the end position of the data in the buffer.- Parameters:
- end- the new end position
 
- 
getOffsetDeprecated.Unused. This method will be removed in Tomcat 12.- Returns:
- start
 
- 
setOffsetDeprecated.Unused. This method will be removed in Tomcat 12.Set start.- Parameters:
- off- the new start
 
- 
getLengthpublic int getLength()- Returns:
- the length of the data in the buffer
 
- 
isNullpublic boolean isNull()- Returns:
- trueif the buffer contains no data
 
- 
indexOfReturn the index of the first occurrence of the subsequence of the given String, or -1 if it is not found.- Parameters:
- src- the String to look for
- srcStart- the subsequence start in the String
- srcLen- the subsequence length in the String
- myOffset- the index on which to start the search in the buffer
- Returns:
- the position of the first character of the first occurrence of the subsequence in the buffer, or -1 if not found
 
- 
recyclepublic void recycle()Resets the chunk to an uninitialized state.
- 
hashCode
- 
hashpublic int hash()- Returns:
- the hash code for this buffer
 
- 
getBufferElementprotected abstract int getBufferElement(int index) - Parameters:
- index- the element location in the buffer
- Returns:
- the element
 
 
-