java::io::CharsetCoder Class Reference

Inheritance diagram for java::io::CharsetCoder:

Inheritance graph
java::io::CharsetDecoderjava::io::CharsetEncoderjava::lang::Object
[legend]
Collaboration diagram for java::io::CharsetCoder:

Collaboration graph
java::lang::Objectjava::lang::Stringjava::lang::Interfacejava::lang::ObjectRefjava::lang::Comparable
[legend]

List of all members.

Public Member Functions

Charsetcharset () const
 Returns the charset that created this coder.
String replacement () const
 Returns this coder's replacement value.
CharsetCoderreplaceWith (const String &newReplacement)
 Changes this coder's replacement value.
virtual
CodingErrorAction
malformedInputAction () const
 Returns this coder's current action for malformed-input errors.
CharsetCoderonMalformedInput (const Ref< CodingErrorAction > &newAction)
 Changes this coder's action for malformed-input errors.
virtual
CodingErrorAction
unmappableCharacterAction () const
 Returns this coder's current action for unmappable-character errors.
CharsetCoderonUnmappableCharacter (const Ref< CodingErrorAction > &newAction)
 Changes this coder's action for unmappable-character errors.
jfloat averageRatio () const
 Returns the average number of characters that will be produced for each byte of input.
jfloat maxRatio () const
 Returns the maximum number of characters that will be produced for each byte of input.
CharsetCoderreset ()
 Resets this coder, clearing any internal state.
virtual jboolean isAutoDetecting () const
 Tells whether or not this coder implements an auto-detecting charset.
virtual jboolean isCharsetDetected () const
 Tells whether or not this coder has yet detected a charset  (optional operation).
virtual Ref< CharsetdetectedCharset () const
 Retrieves the charset that was detected by this coder  (optional operation).

Protected Types

enum  INTERNAL_STATES { ST_RESET, ST_CODING, ST_END, ST_FLUSHED }

Protected Member Functions

 CharsetCoder (const Ref< Charset > &cs, jfloat averageRatio, jfloat maxRation, const String replacement)
 Initializes a new coder.
virtual void implReplaceWith (const String &newReplacement)
 Reports a change to this coder's replacement value.
virtual void implOnMalformedInput (const Ref< CodingErrorAction > &newAction)
 Reports a change to this coder's malformed-input action.
virtual void implOnUnmappableCharacter (const Ref< CodingErrorAction > &newAction)
 Reports a change to this coder's unmappable-character action.
virtual void implReset ()
 Resets this coder, clearing any charset-specific internal state.

Protected Attributes

Ref< Charset_charset
jfloat _averageRatio
jfloat _maxRatio
String _replacement
Ref< CodingErrorAction_malformedInputAction
Ref< CodingErrorAction_unmappableCharacterAction
jint _state

Static Protected Attributes

static const jbytestateNames []


Member Enumeration Documentation

enum java::io::CharsetCoder::INTERNAL_STATES [protected]

Enumerator:
ST_RESET 
ST_CODING 
ST_END 
ST_FLUSHED 


Constructor & Destructor Documentation

java::io::CharsetCoder::CharsetCoder ( const Ref< Charset > &  cs,
jfloat  averageRatio,
jfloat  maxRation,
const String  replacement 
) [protected]

Initializes a new coder.

The new coder will have the given chars-per-byte and replacement values.

Parameters:
averageRatio A positive float value indicating the expected number of characters that will be produced for each input
maxRatio A positive float value indicating the maximum number of characters that will be produced for each input
Exceptions:
IllegalArgumentException If the preconditions on the parameters do not hold


Member Function Documentation

Charset& java::io::CharsetCoder::charset (  )  const

Returns the charset that created this coder.

Returns:
This coder's charset

String java::io::CharsetCoder::replacement (  )  const

Returns this coder's replacement value.

Returns:
This coder's current replacement, which is never null and is never empty

CharsetCoder& java::io::CharsetCoder::replaceWith ( const String newReplacement  ) 

Changes this coder's replacement value.

This method invokes the implReplaceWith method, passing the new replacement, after checking that the new replacement is acceptable.

Parameters:
newReplacement The new replacement; must not be null and must have non-zero length
Returns:
This coder
Exceptions:
IllegalArgumentException If the preconditions on the parameter do not hold

virtual CodingErrorAction& java::io::CharsetCoder::malformedInputAction (  )  const [virtual]

Returns this coder's current action for malformed-input errors.

Returns:
The current malformed-input action, which is never null

CharsetCoder& java::io::CharsetCoder::onMalformedInput ( const Ref< CodingErrorAction > &  newAction  ) 

Changes this coder's action for malformed-input errors.

This method invokes the implOnMalformedInput method, passing the new action.

Parameters:
newAction The new action; must not be null
Returns:
This coder
Exceptions:
IllegalArgumentException If the precondition on the parameter does not hold

virtual CodingErrorAction& java::io::CharsetCoder::unmappableCharacterAction (  )  const [virtual]

Returns this coder's current action for unmappable-character errors.

Returns:
The current unmappable-character action, which is never null

CharsetCoder& java::io::CharsetCoder::onUnmappableCharacter ( const Ref< CodingErrorAction > &  newAction  ) 

Changes this coder's action for unmappable-character errors.

This method invokes the implOnUnmappableCharacter method, passing the new action.

Parameters:
newAction The new action; must not be null
Returns:
This coder
Exceptions:
IllegalArgumentException If the precondition on the parameter does not hold

jfloat java::io::CharsetCoder::averageRatio (  )  const

Returns the average number of characters that will be produced for each byte of input.

This heuristic value may be used to estimate the size of the output buffer required for a given input sequence.

Returns:
The average number of characters produced per byte of input

jfloat java::io::CharsetCoder::maxRatio (  )  const

Returns the maximum number of characters that will be produced for each byte of input.

This value may be used to compute the worst-case size of the output buffer required for a given input sequence.

Returns:
The maximum number of characters that will be produced per byte of input

CharsetCoder& java::io::CharsetCoder::reset (  ) 

Resets this coder, clearing any internal state.

This method resets charset-independent state and also invokes the implReset method in order to perform any charset-specific reset actions.

Returns:
This coder

virtual jboolean java::io::CharsetCoder::isAutoDetecting (  )  const [virtual]

Tells whether or not this coder implements an auto-detecting charset.

The default implementation of this method always returns false; it should be overridden by auto-detecting coders to return true.

Returns:
true if, and only if, this coder implements an auto-detecting charset

virtual jboolean java::io::CharsetCoder::isCharsetDetected (  )  const [virtual]

Tells whether or not this coder has yet detected a charset  (optional operation).

If this coder implements an auto-detecting charset then at a single point during a decoding operation this method may start returning true to indicate that a specific charset has been detected in the input byte sequence. Once this occurs, the detectedCharset method may be invoked to retrieve the detected charset.

That this method returns false does not imply that no bytes have yet been decoded. Some auto-detecting coders are capable of decoding some, or even all, of an input byte sequence without fixing on a particular charset.

The default implementation of this method always throws an UnsupportedOperationException; it should be overridden by auto-detecting coders to return true once the input charset has been determined.

Returns:
true if, and only if, this coder has detected a specific charset
Exceptions:
UnsupportedOperationException If this coder does not implement an auto-detecting charset

virtual Ref<Charset> java::io::CharsetCoder::detectedCharset (  )  const [virtual]

Retrieves the charset that was detected by this coder  (optional operation).

If this coder implements an auto-detecting charset then this method returns the actual charset once it has been detected. After that point, this method returns the same value for the duration of the current decoding operation. If not enough input bytes have yet been read to determine the actual charset then this method throws an IllegalStateException.

The default implementation of this method always throws an UnsupportedOperationException; it should be overridden by auto-detecting coders to return the appropriate value.

Returns:
The charset detected by this auto-detecting coder, or null if the charset has not yet been determined
Exceptions:
IllegalStateException If insufficient bytes have been read to determine a charset
UnsupportedOperationException If this coder does not implement an auto-detecting charset

virtual void java::io::CharsetCoder::implReplaceWith ( const String newReplacement  )  [protected, virtual]

Reports a change to this coder's replacement value.

The default implementation of this method does nothing. This method should be overridden by coders that require notification of changes to the replacement.

Parameters:
newReplacement 

virtual void java::io::CharsetCoder::implOnMalformedInput ( const Ref< CodingErrorAction > &  newAction  )  [protected, virtual]

Reports a change to this coder's malformed-input action.

The default implementation of this method does nothing. This method should be overridden by coders that require notification of changes to the malformed-input action.

virtual void java::io::CharsetCoder::implOnUnmappableCharacter ( const Ref< CodingErrorAction > &  newAction  )  [protected, virtual]

Reports a change to this coder's unmappable-character action.

The default implementation of this method does nothing. This method should be overridden by coders that require notification of changes to the unmappable-character action.

virtual void java::io::CharsetCoder::implReset (  )  [protected, virtual]

Resets this coder, clearing any charset-specific internal state.

The default implementation of this method does nothing. This method should be overridden by coders that maintain internal state.


Member Data Documentation

const jbyte* java::io::CharsetCoder::stateNames[] [static, protected]

Ref<Charset> java::io::CharsetCoder::_charset [protected]

jfloat java::io::CharsetCoder::_averageRatio [protected]

jfloat java::io::CharsetCoder::_maxRatio [protected]

String java::io::CharsetCoder::_replacement [protected]

Ref<CodingErrorAction> java::io::CharsetCoder::_malformedInputAction [protected]

Ref<CodingErrorAction> java::io::CharsetCoder::_unmappableCharacterAction [protected]

jint java::io::CharsetCoder::_state [protected]


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:28 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3