info.monitorenter.cpdetector.io
Class AbstractCodepageDetector

java.lang.Object
  extended by info.monitorenter.cpdetector.io.AbstractCodepageDetector
All Implemented Interfaces:
ICodepageDetector, Serializable, Comparable
Direct Known Subclasses:
ASCIIDetector, ByteOrderMarkDetector, CodepageDetectorProxy, HTMLCodepageDetector, JChardetFacade, ParsingDetector, UnicodeDetector

public abstract class AbstractCodepageDetector
extends Object
implements ICodepageDetector

This implementation provides the default implementation for the high-level codepage detection method open(URL)of the implemented interface ICodepageProcessor.

Also the Comparable interface implementation is provided here by comparing the class-name strings of the implementations.

Author:
Achim Westermann
See Also:
Serialized Form

Constructor Summary
AbstractCodepageDetector()
           
 
Method Summary
 int compareTo(Object o)
           
 Charset detectCodepage(URL url)
          Delegates to ICodepageDetector.detectCodepage(java.io.InputStream, int) with a buffered input stream.
 Reader open(URL url)
          A default delegation to detectCodepage(URL)that opens the document specified by the given URL with the detected codepage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.monitorenter.cpdetector.io.ICodepageDetector
detectCodepage
 

Constructor Detail

AbstractCodepageDetector

public AbstractCodepageDetector()
Method Detail

detectCodepage

public Charset detectCodepage(URL url)
                       throws IOException
Delegates to ICodepageDetector.detectCodepage(java.io.InputStream, int) with a buffered input stream.

Specified by:
detectCodepage in interface ICodepageDetector
Returns:
null, if the codepage of the document specified by the given URL was not detected or the Charsetthat represents the document's codepage.
Throws:
IOException - thrown to indicate that it is was not possible to open the document specified by the given URL.
See Also:
ICodepageDetector.detectCodepage(URL)

open

public final Reader open(URL url)
                  throws IOException
A default delegation to detectCodepage(URL)that opens the document specified by the given URL with the detected codepage.

Specified by:
open in interface ICodepageDetector
Returns:
null, if the codepage of the document specified by the given URL was not detected or a Reader that reads the document in the detected codepage.
Throws:
IOException - thrown to indicate that it is was not possible to open the document specified by the given URL.
See Also:
ICodepageDetector.open(java.net.URL)

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)


Copyleft ㊢ 2003-2004 MPL 1.1, All Rights Footloose.