org.archive.wayback.replay.charset
Class RotatingCharsetDetector

java.lang.Object
  extended by org.archive.wayback.replay.charset.CharsetDetector
      extended by org.archive.wayback.replay.charset.RotatingCharsetDetector

public class RotatingCharsetDetector
extends CharsetDetector

Author:
brad Provides a way to rotate through several detection schemes

Field Summary
static int GUESS_TYPES
           
static int MODE_COUNT
           
static int[][] MODES
           
 
Fields inherited from class org.archive.wayback.replay.charset.CharsetDetector
CHARSET_TOKEN, DEFAULT_CHARSET, HTTP_CONTENT_TYPE_HEADER, MAX_CHARSET_READAHEAD
 
Constructor Summary
RotatingCharsetDetector()
           
 
Method Summary
 String getCharset(Resource resource, int mode)
           
 String getCharset(Resource resource, WaybackRequest request)
           
 String getCharsetType(Resource resource, int type)
           
 int nextMode(int curMode)
           
 
Methods inherited from class org.archive.wayback.replay.charset.CharsetDetector
contentTypeToCharset, getCharsetFromBytes, getCharsetFromHeaders, getCharsetFromMeta, isCharsetSupported, mapCharset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODES

public static final int[][] MODES

MODE_COUNT

public static final int MODE_COUNT
See Also:
Constant Field Values

GUESS_TYPES

public static final int GUESS_TYPES
See Also:
Constant Field Values
Constructor Detail

RotatingCharsetDetector

public RotatingCharsetDetector()
Method Detail

nextMode

public int nextMode(int curMode)

getCharsetType

public String getCharsetType(Resource resource,
                             int type)
                      throws IOException
Throws:
IOException

getCharset

public String getCharset(Resource resource,
                         int mode)
                  throws IOException
Throws:
IOException

getCharset

public String getCharset(Resource resource,
                         WaybackRequest request)
                  throws IOException
Specified by:
getCharset in class CharsetDetector
Parameters:
resource - (presumably text) Resource to determine the charset
request - WaybackRequest which may contain additional hints to processing
Returns:
String charset name for the Resource
Throws:
IOException - if there are problems reading the Resource


Copyright © 2005-2011 Internet Archive. All Rights Reserved.