de.dante.extex.interpreter.loader
Class SerialLoader

java.lang.Object
  extended byde.dante.extex.interpreter.loader.SerialLoader

public class SerialLoader
extends java.lang.Object

This class writes and reads format files.

Format files contains the information needed to continue processing some input. This means that essentially the context is stored.

The Format File

The format file contains certain information in a fixed sequence:

The magic line
This line is ended by a newline character and is used on Unix to make the format executable.
The format identifier
This string is stored as Java object and is used to distinguish formats from other types of files.
The format version
This Java String contains the version number of the file format. It is used to detect incompatible implementations of formats.
The Context
This Java Object contains the interpreter context with all status information.

Version:
$Revision: 1.6 $
Author:
Gerd Neugebauer

Constructor Summary
SerialLoader()
          Creates a new object.
 
Method Summary
 Context load(java.io.InputStream stream)
          Load the interpreter context from an input stream.
 void save(java.io.OutputStream stream, java.lang.String jobname, Context context)
          Write the format information to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialLoader

public SerialLoader()
Creates a new object.

Method Detail

load

public Context load(java.io.InputStream stream)
             throws java.io.IOException,
                    LoaderException
Load the interpreter context from an input stream.

Parameters:
stream - the input stream to read the context from
Returns:
the context read
Throws:
LoaderException - in case of an format error during the read
java.io.IOException - in case of an IO error

save

public void save(java.io.OutputStream stream,
                 java.lang.String jobname,
                 Context context)
          throws java.io.IOException
Write the format information to an output stream.

Parameters:
stream - the output stream to write the context to
jobname - the name of the job currently processed
context - the interpreter context to store
Throws:
java.io.IOException - in case of an IO error