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

public final Class HeaderValue

extends Object
Class Inheritance
Static Imports
org.glassfish.grizzly.http.util.HttpCodecUtils.EMPTY_ARRAY, .HttpCodecUtils.toCheckedByteArray

This class serves as an HTTP header value holder, plus it implements useful utility methods to optimize headers serialization.
Author
Alexey Stashok

Field Summary

Modifier and TypeField and Description
public static final HeaderValue
private byte[]
private final String

Constructor Summary

AccessConstructor and Description
private
HeaderValue(final String value)

Method Summary

Modifier and TypeMethod and Description
public String
get()

Returns: the header value string

public byte[]
getByteArray()

Returns: the byte array representation of the header value

public boolean
isSet()

Returns: true if header value is not null, or false otherwise

public static HeaderValue

Returns:

a HeaderValue wrapper over a String heade value representation
newHeaderValue
(final String
String header value representation
value
)

Creates a HeaderValue wrapper over a String header value representation.

public HeaderValue

Returns:

this HeaderValue
prepare
()

Prepare the HeaderValue for the serialization.

public void
serializeToDataChunk(final DataChunk dc)

Serializes this HeaderValue value into a passed DataChunk.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

IDENTITYback to summary
public static final HeaderValue IDENTITY
preparedByteArrayback to summary
private byte[] preparedByteArray
valueback to summary
private final String value

Constructor Detail

HeaderValueback to summary
private HeaderValue(final String value)

Method Detail

getback to summary
public String get()
Returns:String

the header value string

getByteArrayback to summary
public byte[] getByteArray()
Returns:byte[]

the byte array representation of the header value

isSetback to summary
public boolean isSet()
Returns:boolean

true if header value is not null, or false otherwise

newHeaderValueback to summary
public static HeaderValue newHeaderValue(final String value)

Creates a HeaderValue wrapper over a String header value representation.

Parameters
value:String

String header value representation

Returns:HeaderValue

a HeaderValue wrapper over a String heade value representation

prepareback to summary
public HeaderValue prepare()

Prepare the HeaderValue for the serialization. This method might be particularly useful if we use the same HeaderValue over and over for different responses, so that the HeaderValue will not have to be parsed and prepared for each response separately.

Returns:HeaderValue

this HeaderValue

serializeToDataChunkback to summary
public void serializeToDataChunk(final DataChunk dc)

Serializes this HeaderValue value into a passed DataChunk.

Parameters
dc:DataChunk

DataChunk

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