Class FileHandles
java.lang.Object
org.projog.core.io.FileHandles
Collection of input and output streams.
Each KnowledgeBase has a single unique FileHandles instance.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the stream represented by the specifiedTerm.Return theTermrepresenting the current input stream.Return the current input stream.Return theTermrepresenting the current output stream.Return the current output stream.booleanCreates an intput file stream to read from the file with the specified nameopenOutput(String fileName) Creates an output file stream to write to the file with the specified namevoidSets the current input stream to the input stream represented by the specifiedTerm.voidSets the current output stream to the output stream represented by the specifiedTerm.voidReassigns the "standard" input stream.voidReassigns the "standard" output stream.
-
Field Details
-
USER_OUTPUT_HANDLE
The handle of the "standard" output stream.By default the "standard" output stream will be
System.out. -
USER_INPUT_HANDLE
The handle of the "standard" input stream.By default the "standard" input stream will be
System.in.
-
-
Constructor Details
-
FileHandles
public FileHandles()
-
-
Method Details
-
getCurrentInputHandle
Return theTermrepresenting the current input stream.By default this will be an
Atomwith the name "user_input". -
getCurrentOutputHandle
Return theTermrepresenting the current output stream.By default this will be an
Atomwith the name "user_output". -
getCurrentInputStream
Return the current input stream.By default this will be
System.in. -
getCurrentOutputStream
Return the current output stream.By default this will be
System.out. -
setUserInput
-
setUserOutput
-
setInput
Sets the current input stream to the input stream represented by the specifiedTerm.- Throws:
ProjogException- if the specifiedTermdoes not represent anAtom
-
setOutput
Sets the current output stream to the output stream represented by the specifiedTerm.- Throws:
ProjogException- if the specifiedTermdoes not represent anAtom
-
openInput
Creates an intput file stream to read from the file with the specified name- Parameters:
fileName- the system-dependent filename- Returns:
- a reference to the newly created stream (as required by
setInput(Term)andclose(Term)) - Throws:
ProjogException- if this object's collection of input streams already includes the specified fileIOException- if the file cannot be opened for reading
-
openOutput
Creates an output file stream to write to the file with the specified name- Parameters:
fileName- the system-dependent filename- Returns:
- a reference to the newly created stream (as required by
setOutput(Term)andclose(Term)) - Throws:
ProjogException- if this object's collection of output streams already includes the specified fileIOException- if the file cannot be opened
-
close
Closes the stream represented by the specifiedTerm.- Throws:
ProjogException- if the specifiedTermdoes not represent anAtomIOException- if an I/O error occurs
-
isHandle
-