Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.http.util

public Class DataChunk

extends Object
implements Chunk
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.http.util.Chunk
Known Direct Subclasses
org.glassfish.grizzly.http.util.DataChunk.Immutable, org.glassfish.grizzly.http.util.CacheableDataChunk
Imports
java.io.CharConversionException, .IOException, java.nio.charset.Charset, org.glassfish.grizzly.Buffer

Buffer chunk representation. Helps HTTP module to avoid redundant String creation.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
public static enum

Field Summary

Modifier and TypeField and Description
pack-priv final BufferChunk
pack-priv final ByteChunk
pack-priv final CharChunk
pack-priv String
pack-priv DataChunk.Type

Constructor Summary

AccessConstructor and Description
protected
protected
DataChunk(final ByteChunk byteChunk, final BufferChunk bufferChunk, final CharChunk charChunk, final String stringValue)

Method Summary

Modifier and TypeMethod and Description
public final void
delete(final int from, final int to)

Implements org.glassfish.grizzly.http.util.Chunk.delete.

public void
duplicate(final DataChunk src)

Copy the src into this DataChunk, allocating more space if needed

public boolean

Returns:

true if the passed object represents another DataChunk and its content is equal to this DataChunk's content.
equals
(final Object
the Object to compare
object
)

Overrides java.lang.Object.equals.

Compares this DataChunk and the passed object.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equals
(final String
the String to compare
s
)

Compares the message bytes to the specified String object.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equals
(final ByteChunk
the ByteChunk to compare
byteChunkToCheck
)

Compares the message data to the specified ByteChunk.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equals
(final BufferChunk
the BufferChunk to compare
bufferChunkToCheck
)

Compares the message data to the specified BufferChunk.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equals
(final CharChunk
the CharChunk to compare
charChunkToCheck
)

Compares the message data to the specified CharChunk.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equals
(final byte[]
the byte[] to compare
bytes
)

Compares the message data to the specified byte[].

public boolean

Returns:

true if the comparison succeeded, false otherwise
equals
(final byte[]
the byte[] to compare
bytes
,
final int start, final int len)

Compares the message data to the specified byte[].

public boolean

Returns:

true if the passed object represents another DataChunk and its content is equal to this DataChunk's content ignoring case considerations.
equalsIgnoreCase
(final Object
the Object to compare
object
)

Compares this DataChunk and the passed object ignoring case considerations.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCase
(final String
the String to compare
s
)

Compares the message bytes to the specified String object ignoring case considerations.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCase
(final ByteChunk
the ByteChunk to compare
byteChunkToCheck
)

Compares the message data to the specified ByteChunk ignoring case considerations.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCase
(final BufferChunk
the BufferChunk to compare
bufferChunkToCheck
)

Compares the message data to the specified BufferChunk ignoring case considerations.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCase
(final CharChunk
the CharChunk to compare
charChunkToCheck
)

Compares the message data to the specified CharChunk ignoring case considerations.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCase
(final byte[]
the byte[] to compare
bytes
)

Compares the message data to the specified byte[] ignoring case considerations.

public boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCase
(final byte[]
the byte[] to compare
bytes
,
final int start, final int len)

Compares the message data to the specified byte[] ignoring case considerations.

public final boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCaseLowerCase
(final byte[]
the byte[] to compare
b
)

Compares the data chunk to the specified byte array representing lower-case ASCII characters.

private static boolean

Returns:

true if the comparison succeeded, false otherwise
equalsIgnoreCaseLowerCase
(final String s, final byte[]
the byte[] to compare
b
)

Compares the String to the specified byte array representing lower-case ASCII characters.

public BufferChunk
public ByteChunk
public CharChunk
public int

Returns:

the DataChunk end position.
getEnd
()

Implements org.glassfish.grizzly.http.util.Chunk.getEnd.

Returns the DataChunk end position.

public int

Returns:

the DataChunk length.
getLength
()

Implements org.glassfish.grizzly.http.util.Chunk.getLength.

Returns the DataChunk length.

public int

Returns:

the DataChunk start position.
getStart
()

Implements org.glassfish.grizzly.http.util.Chunk.getStart.

Returns the DataChunk start position.

public DataChunk.Type
public int

Returns:

DataChunk hash code.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns DataChunk hash code.

public final int
indexOf(final char
the character
c
,
final int
The start position
fromIndex
)

Implements org.glassfish.grizzly.http.util.Chunk.indexOf.

Returns true if the message bytes starts with the specified string.

public final int
indexOf(final String
the string
s
,
final int
The start position
fromIndex
)

Implements org.glassfish.grizzly.http.util.Chunk.indexOf.

Returns true if the message bytes starts with the specified string.

public final boolean
public static DataChunk
public static DataChunk
newInstance(final ByteChunk byteChunk, final BufferChunk bufferChunk, final CharChunk charChunk, final String stringValue)

public void
notifyDirectUpdate()

Notify the Chunk that its content is going to be changed directly

public void
protected void
protected void
protected void
protected void
protected void
public void
set(final DataChunk value)

public void
set(final DataChunk value, final int start, final int end)

public void
setBuffer(final Buffer buffer, final int position, final int limit)

public void
setBuffer(final Buffer buffer)

private void
setBufferInternal(final Buffer buffer, final int position, final int limit)

public void
setBytes(final byte[] bytes)

public void
setBytes(final byte[] bytes, final int position, final int limit)

private void
setBytesInternal(final byte[] array, final int position, final int limit)

public void
setChars(final char[] chars, final int position, final int limit)

private void
setCharsInternal(final char[] chars, final int position, final int limit)

public void
setEnd(int
the DataChunk end position.
end
)

Implements org.glassfish.grizzly.http.util.Chunk.setEnd.

Sets the DataChunk end position.

public void
setStart(int
the DataChunk start position.
start
)

Implements org.glassfish.grizzly.http.util.Chunk.setStart.

Sets the DataChunk start position.

public void
setString(String string)

private void
public final boolean

Returns:

true if the DataChunk starts with the specified string.
startsWith
(final String
the string
s
,
final int
The start position
pos
)

Returns true if the DataChunk starts with the specified string.

public final boolean

Returns:

true if the DataChunk starts with the specified string.
startsWithIgnoreCase
(final String
the string
s
,
final int
The start position
pos
)

Returns true if the DataChunk starts with the specified string.

private void
private void
private void
private void
public void
toChars(final Charset charset)

public DataChunk
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
toString(Charset charset)

public String
toString(final int start, final int end)

Implements org.glassfish.grizzly.http.util.Chunk.toString.

public void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

bufferChunkback to summary
pack-priv final BufferChunk bufferChunk
byteChunkback to summary
pack-priv final ByteChunk byteChunk
charChunkback to summary
pack-priv final CharChunk charChunk
stringValueback to summary
pack-priv String stringValue
typeback to summary
pack-priv DataChunk.Type type

Constructor Detail

DataChunkback to summary
protected DataChunk()
DataChunkback to summary
protected DataChunk(final ByteChunk byteChunk, final BufferChunk bufferChunk, final CharChunk charChunk, final String stringValue)

Method Detail

deleteback to summary
public final void delete(final int from, final int to)

Implements org.glassfish.grizzly.http.util.Chunk.delete.

Annotations
@Override
duplicateback to summary
public void duplicate(final DataChunk src)

Copy the src into this DataChunk, allocating more space if needed

equalsback to summary
public boolean equals(final Object object)

Overrides java.lang.Object.equals.

Compares this DataChunk and the passed object.

Parameters
object:Object

the Object to compare

Returns:boolean

true if the passed object represents another DataChunk and its content is equal to this DataChunk's content.

Annotations
@Override
equalsback to summary
public boolean equals(final String s)

Compares the message bytes to the specified String object.

Parameters
s:String

the String to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsback to summary
public boolean equals(final ByteChunk byteChunkToCheck)

Compares the message data to the specified ByteChunk.

Parameters
byteChunkToCheck:ByteChunk

the ByteChunk to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsback to summary
public boolean equals(final BufferChunk bufferChunkToCheck)

Compares the message data to the specified BufferChunk.

Parameters
bufferChunkToCheck:BufferChunk

the BufferChunk to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsback to summary
public boolean equals(final CharChunk charChunkToCheck)

Compares the message data to the specified CharChunk.

Parameters
charChunkToCheck:CharChunk

the CharChunk to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsback to summary
public boolean equals(final byte[] bytes)

Compares the message data to the specified byte[].

Parameters
bytes:byte[]

the byte[] to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsback to summary
public boolean equals(final byte[] bytes, final int start, final int len)

Compares the message data to the specified byte[].

Parameters
bytes:byte[]

the byte[] to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final Object object)

Compares this DataChunk and the passed object ignoring case considerations.

Parameters
object:Object

the Object to compare

Returns:boolean

true if the passed object represents another DataChunk and its content is equal to this DataChunk's content ignoring case considerations.

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final String s)

Compares the message bytes to the specified String object ignoring case considerations.

Parameters
s:String

the String to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final ByteChunk byteChunkToCheck)

Compares the message data to the specified ByteChunk ignoring case considerations.

Parameters
byteChunkToCheck:ByteChunk

the ByteChunk to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final BufferChunk bufferChunkToCheck)

Compares the message data to the specified BufferChunk ignoring case considerations.

Parameters
bufferChunkToCheck:BufferChunk

the BufferChunk to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final CharChunk charChunkToCheck)

Compares the message data to the specified CharChunk ignoring case considerations.

Parameters
charChunkToCheck:CharChunk

the CharChunk to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final byte[] bytes)

Compares the message data to the specified byte[] ignoring case considerations.

Parameters
bytes:byte[]

the byte[] to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(final byte[] bytes, final int start, final int len)

Compares the message data to the specified byte[] ignoring case considerations.

Parameters
bytes:byte[]

the byte[] to compare

Returns:boolean

true if the comparison succeeded, false otherwise

equalsIgnoreCaseLowerCaseback to summary
public final boolean equalsIgnoreCaseLowerCase(final byte[] b)

Compares the data chunk to the specified byte array representing lower-case ASCII characters.

Parameters
b:byte[]

the byte[] to compare

Returns:boolean

true if the comparison succeeded, false otherwise

Since
2.1.2
equalsIgnoreCaseLowerCaseback to summary
private static boolean equalsIgnoreCaseLowerCase(final String s, final byte[] b)

Compares the String to the specified byte array representing lower-case ASCII characters.

Parameters
b:byte[]

the byte[] to compare

Returns:boolean

true if the comparison succeeded, false otherwise

Since
2.1.2
getBufferChunkback to summary
public BufferChunk getBufferChunk()
getByteChunkback to summary
public ByteChunk getByteChunk()
getCharChunkback to summary
public CharChunk getCharChunk()
getEndback to summary
public int getEnd()

Implements org.glassfish.grizzly.http.util.Chunk.getEnd.

Returns the DataChunk end position.

Returns:int

the DataChunk end position.

Annotations
@Override
getLengthback to summary
public int getLength()

Implements org.glassfish.grizzly.http.util.Chunk.getLength.

Returns the DataChunk length.

Returns:int

the DataChunk length.

Annotations
@Override
getStartback to summary
public int getStart()

Implements org.glassfish.grizzly.http.util.Chunk.getStart.

Returns the DataChunk start position.

Returns:int

the DataChunk start position.

Annotations
@Override
getTypeback to summary
public DataChunk.Type getType()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns DataChunk hash code.

Returns:int

DataChunk hash code.

Annotations
@Override
indexOfback to summary
public final int indexOf(final char c, final int fromIndex)

Implements org.glassfish.grizzly.http.util.Chunk.indexOf.

Returns true if the message bytes starts with the specified string.

Parameters
c:char

the character

fromIndex:int

The start position

Annotations
@Override
indexOfback to summary
public final int indexOf(final String s, final int fromIndex)

Implements org.glassfish.grizzly.http.util.Chunk.indexOf.

Returns true if the message bytes starts with the specified string.

Parameters
s:String

the string

fromIndex:int

The start position

Annotations
@Override
isNullback to summary
public final boolean isNull()
newInstanceback to summary
public static DataChunk newInstance()
newInstanceback to summary
public static DataChunk newInstance(final ByteChunk byteChunk, final BufferChunk bufferChunk, final CharChunk charChunk, final String stringValue)
notifyDirectUpdateback to summary
public void notifyDirectUpdate()

Notify the Chunk that its content is going to be changed directly

recycleback to summary
public void recycle()
resetback to summary
protected void reset()
resetBufferback to summary
protected void resetBuffer()
resetByteChunkback to summary
protected void resetByteChunk()
resetCharChunkback to summary
protected void resetCharChunk()
resetStringback to summary
protected void resetString()
setback to summary
public void set(final DataChunk value)
setback to summary
public void set(final DataChunk value, final int start, final int end)
setBufferback to summary
public void setBuffer(final Buffer buffer, final int position, final int limit)
setBufferback to summary
public void setBuffer(final Buffer buffer)
setBufferInternalback to summary
private void setBufferInternal(final Buffer buffer, final int position, final int limit)
setBytesback to summary
public void setBytes(final byte[] bytes)
setBytesback to summary
public void setBytes(final byte[] bytes, final int position, final int limit)
setBytesInternalback to summary
private void setBytesInternal(final byte[] array, final int position, final int limit)
setCharsback to summary
public void setChars(final char[] chars, final int position, final int limit)
setCharsInternalback to summary
private void setCharsInternal(final char[] chars, final int position, final int limit)
setEndback to summary
public void setEnd(int end)

Implements org.glassfish.grizzly.http.util.Chunk.setEnd.

Sets the DataChunk end position.

Parameters
end:int

the DataChunk end position.

Annotations
@Override
setStartback to summary
public void setStart(int start)

Implements org.glassfish.grizzly.http.util.Chunk.setStart.

Sets the DataChunk start position.

Parameters
start:int

the DataChunk start position.

Annotations
@Override
setStringback to summary
public void setString(String string)
setStringInternalback to summary
private void setStringInternal(String string)
startsWithback to summary
public final boolean startsWith(final String s, final int pos)

Returns true if the DataChunk starts with the specified string.

Parameters
s:String

the string

pos:int

The start position

Returns:boolean

true if the DataChunk starts with the specified string.

startsWithIgnoreCaseback to summary
public final boolean startsWithIgnoreCase(final String s, final int pos)

Returns true if the DataChunk starts with the specified string.

Parameters
s:String

the string

pos:int

The start position

Returns:boolean

true if the DataChunk starts with the specified string.

switchToBufferChunkback to summary
private void switchToBufferChunk()
switchToByteChunkback to summary
private void switchToByteChunk()
switchToCharChunkback to summary
private void switchToCharChunk()
switchToStringback to summary
private void switchToString()
toCharsback to summary
public void toChars(final Charset charset) throws CharConversionException
toImmutableback to summary
public DataChunk toImmutable()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
toStringback to summary
public String toString(Charset charset)
toStringback to summary
public String toString(final int start, final int end)

Implements org.glassfish.grizzly.http.util.Chunk.toString.

Annotations
@Override
trimLeftback to summary
public void trimLeft()
org.glassfish.grizzly.http.util back to summary

pack-priv final Class DataChunk.Immutable

extends DataChunk
Class Inheritance

Field Summary

Inherited from org.glassfish.grizzly.http.util.DataChunk:
bufferChunkbyteChunkcharChunkstringValuetype

Constructor Summary

AccessConstructor and Description
public
Immutable(DataChunk original)

Method Summary

Modifier and TypeMethod and Description
public void
protected void
protected void
protected void
protected void
public void
public void
public void
setChars(char[] chars, int position, int limit)

Overrides org.glassfish.grizzly.http.util.DataChunk.setChars.

public void
public DataChunk
Inherited from org.glassfish.grizzly.http.util.DataChunk:
deleteduplicateequalsequalsequalsequalsequalsequalsequalsequalsIgnoreCaseequalsIgnoreCaseequalsIgnoreCaseequalsIgnoreCaseequalsIgnoreCaseequalsIgnoreCaseequalsIgnoreCaseequalsIgnoreCaseLowerCasegetBufferChunkgetByteChunkgetCharChunkgetEndgetLengthgetStartgetTypehashCodeindexOfindexOfisNullnewInstancenewInstancenotifyDirectUpdateresetByteChunksetsetBuffersetBytessetBytessetEndsetStartstartsWithstartsWithIgnoreCasetoCharstoStringtoStringtoStringtrimLeft

Constructor Detail

Immutableback to summary
public Immutable(DataChunk original)

Method Detail

recycleback to summary
public void recycle()

Overrides org.glassfish.grizzly.http.util.DataChunk.recycle.

Annotations
@Override
resetback to summary
protected void reset()

Overrides org.glassfish.grizzly.http.util.DataChunk.reset.

Annotations
@Override
resetBufferback to summary
protected void resetBuffer()

Overrides org.glassfish.grizzly.http.util.DataChunk.resetBuffer.

Annotations
@Override
resetCharChunkback to summary
protected void resetCharChunk()

Overrides org.glassfish.grizzly.http.util.DataChunk.resetCharChunk.

Annotations
@Override
resetStringback to summary
protected void resetString()

Overrides org.glassfish.grizzly.http.util.DataChunk.resetString.

Annotations
@Override
setback to summary
public void set(DataChunk value)

Overrides org.glassfish.grizzly.http.util.DataChunk.set.

Annotations
@Override
setBufferback to summary
public void setBuffer(Buffer buffer, int start, int end)

Overrides org.glassfish.grizzly.http.util.DataChunk.setBuffer.

Annotations
@Override
setCharsback to summary
public void setChars(char[] chars, int position, int limit)

Overrides org.glassfish.grizzly.http.util.DataChunk.setChars.

Annotations
@Override
setStringback to summary
public void setString(String string)

Overrides org.glassfish.grizzly.http.util.DataChunk.setString.

Annotations
@Override
toImmutableback to summary
public DataChunk toImmutable()

Overrides org.glassfish.grizzly.http.util.DataChunk.toImmutable.

Annotations
@Override
org.glassfish.grizzly.http.util back to summary

public final Enum DataChunk.Type

extends Enum<DataChunk.Type>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final DataChunk.Type
public static final DataChunk.Type
public static final DataChunk.Type
public static final DataChunk.Type
public static final DataChunk.Type

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public static DataChunk.Type
public static DataChunk.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Bufferback to summary
public static final DataChunk.Type Buffer
Bytesback to summary
public static final DataChunk.Type Bytes
Charsback to summary
public static final DataChunk.Type Chars
Noneback to summary
public static final DataChunk.Type None
Stringback to summary
public static final DataChunk.Type String

Constructor Detail

Typeback to summary
private Type()

Method Detail

valueOfback to summary
public static DataChunk.Type valueOf(String name)
valuesback to summary
public static DataChunk.Type[] values()