Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller

public final Class IntArrayData

extends Pcdata
Class Inheritance
Imports
org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata, .UTF8XmlOutput, java.io.IOException

Typed CharSequence for int[].

Fed to unmarshaller when the 'text' data is actually a virtual image of int array.

This class holds int[] as a triplet of (data,start,len) where 'start' and 'len' represents the start position of the data and the length.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private int[]
private int
private StringBuilder
literal

String representation of the data.

private int

Constructor Summary

AccessConstructor and Description
public
IntArrayData(int[] data, int start, int len)

public

Method Summary

Modifier and TypeMethod and Description
public char
charAt(int index)

Implements java.lang.CharSequence.charAt.

Returns the char value at the specified index.

private StringBuilder
getLiteral()

Computes the literal form from the data.

public int
length()

Implements java.lang.CharSequence.length.

Returns the length of this character sequence.

public void
set(int[] data, int start, int len)

Sets the int[] data to this object.

public CharSequence
subSequence(int start, int end)

Implements java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence.

public String
toString()

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata.toString.

Implements java.lang.CharSequence.toString.

Returns a string containing the characters in this sequence in the same order as this sequence.

public void
Inherited from org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata:
writeTo

Field Detail

databack to summary
private int[] data
lenback to summary
private int len
literalback to summary
private StringBuilder literal

String representation of the data. Lazily computed.

startback to summary
private int start

Constructor Detail

IntArrayDataback to summary
public IntArrayData(int[] data, int start, int len)
IntArrayDataback to summary
public IntArrayData()

Method Detail

charAtback to summary
public char charAt(int index)

Implements java.lang.CharSequence.charAt.

Doc from java.lang.CharSequence.charAt.

Returns the char value at the specified index. An index ranges from zero to length() - 1. The first char value of the sequence is at index zero, the next at index one, and so on, as for array indexing.

If the char value specified by the index is a surrogate, the surrogate value is returned.

Annotations
@Override
getLiteralback to summary
private StringBuilder getLiteral()

Computes the literal form from the data.

lengthback to summary
public int length()

Implements java.lang.CharSequence.length.

Doc from java.lang.CharSequence.length.

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Annotations
@Override
setback to summary
public void set(int[] data, int start, int len)

Sets the int[] data to this object.

This method doesn't make a copy for a performance reason. The caller is still free to modify the array it passed to this method, but he should do so with a care. The unmarshalling code isn't expecting the value to be changed while it's being routed.

subSequenceback to summary
public CharSequence subSequence(int start, int end)

Implements java.lang.CharSequence.subSequence.

Doc from java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence. The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.

Annotations
@Override
toStringback to summary
public String toString()

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata.toString.

Implements java.lang.CharSequence.toString.

Doc from java.lang.CharSequence.toString.

Returns a string containing the characters in this sequence in the same order as this sequence. The length of the string will be the length of this sequence.

Annotations
@Override
writeToback to summary
public void writeTo(UTF8XmlOutput output) throws IOException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata.writeTo.

Doc from org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata.writeTo.

Writes itself to UTF8XmlOutput.

This is the most performance critical path for the marshaller, so it warrants its own method.

Annotations
@Override