CharsetCoder.h

Go to the documentation of this file.
00001 #ifndef JAVA_IO_CHARSETCODER_H
00002 #define JAVA_IO_CHARSETCODER_H 1
00003 
00004 #ifndef JAVA_IO_CHARSET_H
00005 #include <java_io/Charset.h>
00006 #endif /* JAVA_IO_CHARSET_H */
00007 #ifndef JAVA_IO_CODINGERRORACTION_H
00008 #include <java_io/CodingErrorAction.h>
00009 #endif /* JAVA_IO_CODINGERRORACTION_H */
00010 #ifndef JAVA_IO_CODERRESULT_H
00011 #include <java_io/CoderResult.h>
00012 #endif /* JAVA_IO_CODERRESULT_H */
00013 
00014 namespace java {
00015   namespace io {
00016 
00017     class JAVA_IO_SPEC CharsetCoder : public Object {
00018 
00019     public:
00020   
00026       Charset& charset() const;
00027       
00034       String replacement() const;
00035 
00053       CharsetCoder& replaceWith(const String& newReplacement);
00054 
00060       virtual CodingErrorAction& malformedInputAction() const;
00061 
00075       CharsetCoder& onMalformedInput(const Ref<CodingErrorAction>& newAction);
00076 
00084       virtual CodingErrorAction& unmappableCharacterAction() const;
00085 
00099       CharsetCoder& onUnmappableCharacter(const Ref<CodingErrorAction>& newAction);
00100 
00109       jfloat averageRatio() const;
00110 
00119       jfloat maxRatio() const;
00120 
00131       CharsetCoder& reset();
00132 
00143       virtual jboolean isAutoDetecting() const;
00144 
00171       virtual jboolean isCharsetDetected() const;
00172 
00197       virtual Ref<Charset> detectedCharset() const;
00198 
00199     protected:
00200 
00201       enum INTERNAL_STATES {
00202         ST_RESET,
00203         ST_CODING,
00204         ST_END,
00205         ST_FLUSHED,
00206       };
00207 
00208       static const jbyte* stateNames[];
00209 
00225       CharsetCoder
00226         (const Ref<Charset>& cs,
00227          jfloat averageRatio,
00228          jfloat maxRation,
00229          const String replacement);
00230 
00240       virtual void implReplaceWith(const String& newReplacement);
00241 
00249       virtual void implOnMalformedInput(const Ref<CodingErrorAction>& newAction);
00250 
00258       virtual void implOnUnmappableCharacter(const Ref<CodingErrorAction>& newAction);
00259 
00266       virtual void implReset();
00267 
00268       Ref<Charset> _charset;
00269       jfloat _averageRatio;
00270       jfloat _maxRatio;
00271       String _replacement;
00272       Ref<CodingErrorAction> _malformedInputAction;
00273       Ref<CodingErrorAction> _unmappableCharacterAction;
00274       jint _state;
00275 
00276     private:
00277 
00278       REGISTER_MEMBERS;
00279 
00280     };
00281 
00282   } // namespace io
00283 } // namespace java
00284 
00285 #endif /* JAVA_IO_CHARSETCODER_H */

Generated on Fri May 16 11:54:42 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3