public class GenericReplayCharSequence extends Object implements ReplayCharSequence
InMemoryReplayCharSequence.
Call close() on this class when done to clean up resources.
| Modifier and Type | Field and Description |
|---|---|
protected Charset |
charset |
protected CharacterCodingException |
codingException |
protected long |
decodingExceptions
counter of decoding exceptions for report at end
|
protected int |
length
Total length of character stream to replay minus the HTTP headers
if present.
|
protected static Logger |
logger |
static Charset |
WRITE_ENCODING
Name of the encoding we use writing out concatenated decoded prefix
buffer and decoded backing file.
|
FALLBACK_CHARSET| Constructor and Description |
|---|
GenericReplayCharSequence(InputStream contentReplayInputStream,
int prefixMax,
String backingFilename,
Charset charset)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int index)
Get character at passed absolute position.
|
void |
close()
Call this method when done so implementation has chance to clean up
resources.
|
protected void |
decode(InputStream inStream,
int prefixMax,
String backingFilename,
Charset charset)
Converts the first
Integer.MAX_VALUE characters from the
file backingFilename from encoding encoding to
encoding WRITE_ENCODING and saves as
this.decodedFile, which is named backingFilename
+ "." + WRITE_ENCODING. |
protected void |
finalize() |
Charset |
getCharset()
Return the effective Charset used to create this CharSequence from
(raw byte) source material.
|
CharacterCodingException |
getCodingException()
Return the first coding-exception encountered, if the count > 0.
|
long |
getDecodeExceptionCount()
Report count of decoder errors silently eaten during ReplayCharSequence
use.
|
boolean |
isOpen() |
int |
length() |
CharSequence |
subSequence(int start,
int end) |
String |
substring(int offset,
int len)
Deprecated.
please use subSequence() and then toString() directly
|
String |
toString() |
protected static Logger logger
public static final Charset WRITE_ENCODING
This define is also used as suffix for the file that holds the decodings. The name of the file that holds the decoding is the name of the backing file w/ this encoding for a suffix.
See Encoding.
protected int length
Integer.MAX_VALUE (i.e. 2gb),
only the first Integer.MAX_VALUE characters are available through this API.
We're overriding java.lang.CharSequence so that we can use
java.util.regex directly on the data, and the CharSequence
API uses int for the length and index.protected long decodingExceptions
protected CharacterCodingException codingException
protected Charset charset
public GenericReplayCharSequence(InputStream contentReplayInputStream, int prefixMax, String backingFilename, Charset charset) throws IOException
contentReplayInputStream - inputStream of contentcharset - Encoding to use reading the passed prefix
buffer and backing file. Must not be null.backingFilename - Path to backing file with content in excess of
whats in buffer.IOExceptionprotected void decode(InputStream inStream, int prefixMax, String backingFilename, Charset charset) throws IOException
Integer.MAX_VALUE characters from the
file backingFilename from encoding encoding to
encoding WRITE_ENCODING and saves as
this.decodedFile, which is named backingFilename
+ "." + WRITE_ENCODING.IOExceptionpublic char charAt(int index)
charAt in interface CharSequenceindex - Index into contentindex.public CharSequence subSequence(int start, int end)
subSequence in interface CharSequencepublic boolean isOpen()
isOpen in interface ReplayCharSequenceReplayCharSequence.close() has been calledpublic void close()
throws IOException
ReplayCharSequenceclose in interface Closeableclose in interface AutoCloseableclose in interface ReplayCharSequenceIOException - Problem cleaning up file system resources.protected void finalize()
throws Throwable
public String substring(int offset, int len)
public String toString()
toString in interface CharSequencetoString in class Objectpublic int length()
length in interface CharSequencepublic long getDecodeExceptionCount()
ReplayCharSequencegetDecodeExceptionCount in interface ReplayCharSequencepublic CharacterCodingException getCodingException()
ReplayCharSequencegetCodingException in interface ReplayCharSequencepublic Charset getCharset()
ReplayCharSequencegetCharset in interface ReplayCharSequenceCopyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.