org.apache.abdera.i18n.text.io
Class CharsetSniffingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.apache.abdera.i18n.text.io.CharsetSniffingInputStream
All Implemented Interfaces:
Closeable

public class CharsetSniffingInputStream
extends FilterInputStream

Will attempt to autodetect the character encoding from the stream By default, this will preserve the BOM if it exists


Nested Class Summary
static class CharsetSniffingInputStream.Encoding
           
 
Field Summary
protected  boolean bomset
           
protected  String encoding
           
protected  boolean preserve
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CharsetSniffingInputStream(InputStream in)
           
CharsetSniffingInputStream(InputStream in, boolean preserveBom)
           
 
Method Summary
protected  String detectEncoding()
           
 String getEncoding()
           
protected  PeekAheadInputStream getInternal()
           
 boolean isBomSet()
           
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encoding

protected String encoding

bomset

protected boolean bomset

preserve

protected final boolean preserve
Constructor Detail

CharsetSniffingInputStream

public CharsetSniffingInputStream(InputStream in)

CharsetSniffingInputStream

public CharsetSniffingInputStream(InputStream in,
                                  boolean preserveBom)
Method Detail

isBomSet

public boolean isBomSet()

getEncoding

public String getEncoding()

getInternal

protected PeekAheadInputStream getInternal()

detectEncoding

protected String detectEncoding()
                         throws IOException
Throws:
IOException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.