info.monitorenter.cpdetector.io
Class HTMLCodepageDetector

java.lang.Object
  extended byinfo.monitorenter.cpdetector.io.AbstractCodepageDetector
      extended byinfo.monitorenter.cpdetector.io.HTMLCodepageDetector
All Implemented Interfaces:
Comparable, ICodepageDetector, Serializable

Deprecated. This class should not be used in new code. It has been replaced by ParsingDetector. Future versions may drop this class.

public class HTMLCodepageDetector
extends AbstractCodepageDetector

This class has been replaced by ParsingDetector and only exists for backward-compatibility. The name simply would not match any more, as parsing is not limited to html (1.1 includes xml as well). New code should stick to the replacement. This class has been modified with version 1.1 and now is delegating all calls to an instance of the replacement class (5 minutes with eclipse and a common interface), which introduces a small overhead (minimal, as one invokevirtual is nothing compared to codepage detection by parsing).

Documentation may be found in the class ParsingDetector. It is valid for this class.

Version:
1.1
Author:
Achim Westermann
See Also:
ParsingDetector, Serialized Form

Constructor Summary
HTMLCodepageDetector()
          Deprecated.  
HTMLCodepageDetector(boolean verbose)
          Deprecated.  
 
Method Summary
 int compareTo(Object o)
          Deprecated.  
 Charset detectCodepage(InputStream in, int length)
          Deprecated.  This method allows to detect the charset encoding from every source (even a String, which an URL does not decorate!).
 Charset detectCodepage(URL url)
          Deprecated. Delegates to detectCodepage(java.io.InputStream, int) with a buffered input stream.
 boolean equals(Object obj)
          Deprecated.  
 int hashCode()
          Deprecated.  
 String toString()
          Deprecated.  
 
Methods inherited from class info.monitorenter.cpdetector.io.AbstractCodepageDetector
open
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTMLCodepageDetector

public HTMLCodepageDetector()
Deprecated. 

HTMLCodepageDetector

public HTMLCodepageDetector(boolean verbose)
Deprecated. 
Method Detail

compareTo

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

detectCodepage

public Charset detectCodepage(InputStream in,
                              int length)
                       throws IOException
Deprecated. 
Description copied from interface: ICodepageDetector

This method allows to detect the charset encoding from every source (even a String, which an URL does not decorate!).

Note that you cannot reuse the given InputStream unless it supports marking (InputStream.markSupported() == true), you mark the initial position with a sufficient readlimit and invoke reset afterwards (without getting any exception).

Parameters:
in - An InputStream for the document, that supports mark and a readlimit of argument length.
length - The amount of bytes to take into account. This number should not be longer than the amount of bytes retrievable from the InputStream but should be as long as possible to give the fallback detection (chardet) more hints to guess.
Throws:
IOException

detectCodepage

public Charset detectCodepage(URL url)
                       throws IOException
Deprecated. 
Description copied from class: AbstractCodepageDetector
Delegates to ICodepageDetector.detectCodepage(java.io.InputStream, int) with a buffered input stream.

Specified by:
detectCodepage in interface ICodepageDetector
Overrides:
detectCodepage in class AbstractCodepageDetector
Throws:
IOException
See Also:
ICodepageDetector.detectCodepage(URL)

equals

public boolean equals(Object obj)
Deprecated. 

hashCode

public int hashCode()
Deprecated. 

toString

public String toString()
Deprecated. 


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