org.extex.base.type.file
Class OutputFile

java.lang.Object
  extended by org.extex.base.type.file.OutputFile
All Implemented Interfaces:
java.io.Serializable, OutFile
Direct Known Subclasses:
ExecuteFile, LogFile, UserAndLogFile

public class OutputFile
extends java.lang.Object
implements OutFile

This class holds an output file onto which tokens can be written.

Version:
$Revision:5563 $
Author:
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
 
Constructor Summary
OutputFile(java.io.File name)
          Creates a new object.
 
Method Summary
 void close()
          Close the current file.
 boolean isOpen()
          Check whether the output file is open.
 void newline()
          Write out a newline.
 void open(java.lang.String key, java.lang.String encoding, TokenStreamFactory factory)
          Open the current file.
protected  java.io.Writer use(java.io.Writer w)
          Interceptor method for writer initialization.
 boolean write(Tokens toks)
          Write some tokens to the output writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail

OutputFile

public OutputFile(java.io.File name)
Creates a new object.

Parameters:
name - the file to write to
Method Detail

close

public void close()
           throws java.io.IOException
Close the current file.

Specified by:
close in interface OutFile
Throws:
java.io.IOException - in case of an error

isOpen

public boolean isOpen()
Check whether the output file is open.

Specified by:
isOpen in interface OutFile
Returns:
true iff the instance is open

newline

public void newline()
             throws java.io.IOException
Write out a newline.

Specified by:
newline in interface OutFile
Throws:
java.io.IOException - in case of an error
See Also:
OutFile.newline()

open

public void open(java.lang.String key,
                 java.lang.String encoding,
                 TokenStreamFactory factory)
          throws java.io.UnsupportedEncodingException
Open the current file. Open the current file.

Specified by:
open in interface OutFile
Parameters:
key - the key
encoding - the encoding or null for the default encoding
factory - the token stream factory
Throws:
java.io.UnsupportedEncodingException - in case of an invalid encoding
See Also:
OutFile.open(java.lang.String, java.lang.String, TokenStreamFactory)

use

protected java.io.Writer use(java.io.Writer w)
Interceptor method for writer initialization.

Parameters:
w - the writer at hand
Returns:
the writer to use instead

write

public boolean write(Tokens toks)
              throws HelpingException,
                     java.io.IOException
Write some tokens to the output writer.

Specified by:
write in interface OutFile
Parameters:
toks - tokens to write
Returns:
true iff the writing was successful
Throws:
HelpingException - in case of an error
java.io.IOException - in case of an IO error
See Also:
OutFile.write(org.extex.scanner.type.tokens.Tokens)