org.apache.manifoldcf.core.interfaces
Class TempFileCharacterInput

java.lang.Object
  extended by org.apache.manifoldcf.core.interfaces.CharacterInput
      extended by org.apache.manifoldcf.core.interfaces.TempFileCharacterInput

public class TempFileCharacterInput
extends CharacterInput

This class represents a temporary file character input stream. Call the "done" method to clean up the file when done. NOTE: The implied flow of this method is to be handled a file that has already been created by some means. The file must be a dedicated temporary file, which can be destroyed when the data has been used.


Field Summary
static java.lang.String _rcsid
           
protected static int CHUNK_SIZE
           
protected  java.io.File file
           
 
Fields inherited from class org.apache.manifoldcf.core.interfaces.CharacterInput
charLength, hashValue, stream
 
Constructor Summary
protected TempFileCharacterInput()
           
  TempFileCharacterInput(java.io.File tempFile)
          Construct from an existing temporary fle.
  TempFileCharacterInput(java.io.Reader is)
          Construct from a length-delimited reader.
 
Method Summary
protected  void calculateHashValue()
          Calculate the datum's hash value
protected  void calculateLength()
          Calculate the datum's length in characters
 void discard()
          Discard this object permanently
 java.io.InputStream getUtf8Stream()
          Open a Utf8 stream directly from the backing file
protected  void openStream()
          Open a reader, for use by a caller, until closeStream is called
 CharacterInput transfer()
          Transfer to a new object; this causes the current object to become "already discarded"
 
Methods inherited from class org.apache.manifoldcf.core.interfaces.CharacterInput
closeStream, doneWithStream, getCharacterLength, getHashValue, getStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values

file

protected java.io.File file

CHUNK_SIZE

protected static final int CHUNK_SIZE
See Also:
Constant Field Values
Constructor Detail

TempFileCharacterInput

public TempFileCharacterInput(java.io.Reader is)
                       throws ManifoldCFException
Construct from a length-delimited reader.

Parameters:
is - is a reader to transfer from, to the end of the data. This will, as a side effect, also calculate the character length and hash value for the data.
Throws:
ManifoldCFException

TempFileCharacterInput

public TempFileCharacterInput(java.io.File tempFile)
Construct from an existing temporary fle.

Parameters:
tempFile - is the existing temporary file, encoded in utf-8.

TempFileCharacterInput

protected TempFileCharacterInput()
Method Detail

getUtf8Stream

public java.io.InputStream getUtf8Stream()
                                  throws ManifoldCFException
Open a Utf8 stream directly from the backing file

Specified by:
getUtf8Stream in class CharacterInput
Throws:
ManifoldCFException

openStream

protected void openStream()
                   throws ManifoldCFException
Description copied from class: CharacterInput
Open a reader, for use by a caller, until closeStream is called

Specified by:
openStream in class CharacterInput
Throws:
ManifoldCFException

transfer

public CharacterInput transfer()
Transfer to a new object; this causes the current object to become "already discarded"

Specified by:
transfer in class CharacterInput

discard

public void discard()
             throws ManifoldCFException
Description copied from class: CharacterInput
Discard this object permanently

Overrides:
discard in class CharacterInput
Throws:
ManifoldCFException

calculateLength

protected void calculateLength()
                        throws ManifoldCFException
Calculate the datum's length in characters

Specified by:
calculateLength in class CharacterInput
Throws:
ManifoldCFException

calculateHashValue

protected void calculateHashValue()
                           throws ManifoldCFException
Calculate the datum's hash value

Specified by:
calculateHashValue in class CharacterInput
Throws:
ManifoldCFException