Package org.codehaus.stax2.ri.typed
Class ValueEncoderFactory.TokenEncoder
java.lang.Object
org.codehaus.stax2.ri.typed.AsciiValueEncoder
org.codehaus.stax2.ri.typed.ValueEncoderFactory.ScalarEncoder
org.codehaus.stax2.ri.typed.ValueEncoderFactory.TokenEncoder
- Enclosing class:
ValueEncoderFactory
Implementation of textual encoder that operates on short
textual values ("tokens"). As such, it can count on being able
to output the whole output in one pass, without tracking
location
-
Field Summary
FieldsFields inherited from class org.codehaus.stax2.ri.typed.AsciiValueEncoder
MIN_CHARS_WITHOUT_FLUSH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
encodeMore
(byte[] buffer, int ptr, int end) int
encodeMore
(char[] buffer, int ptr, int end) boolean
Method that can alternatively be called to determine whether encoder has encoded all data it has.protected void
Methods inherited from class org.codehaus.stax2.ri.typed.AsciiValueEncoder
bufferNeedsFlush
-
Field Details
-
_value
String _value
-
-
Constructor Details
-
TokenEncoder
protected TokenEncoder()
-
-
Method Details
-
reset
-
isCompleted
public boolean isCompleted()Description copied from class:AsciiValueEncoder
Method that can alternatively be called to determine whether encoder has encoded all data it has. Generally called right after a call toAsciiValueEncoder.encodeMore(char[], int, int)
, to figure out whether buffer flush is needed (there is more data), or encoding is complete.- Specified by:
isCompleted
in classAsciiValueEncoder
-
encodeMore
public int encodeMore(char[] buffer, int ptr, int end) - Specified by:
encodeMore
in classAsciiValueEncoder
- Returns:
- Value of pointer after all remaining data (which
may be "none") that can be encoded (as constrained by
buffer length) has been encoded. Has to exceed 'ptr'
value sent in; will be equal to it if nothing was
encoded (which should only occur when everything has
been encoded, as long as
AsciiValueEncoder.bufferNeedsFlush(int)
is appropriately called once before calling this method)
-
encodeMore
public int encodeMore(byte[] buffer, int ptr, int end) - Specified by:
encodeMore
in classAsciiValueEncoder
- Returns:
- Value of pointer after all remaining data (which
may be "none") that can be encoded (as constrained by
buffer length) has been encoded. Has to exceed 'ptr'
value sent in; will be equal to it if nothing was
encoded (which should only occur when everything has
been encoded, as long as
AsciiValueEncoder.bufferNeedsFlush(int)
is appropriately called once before calling this method)
-