Package coneforest.psylla.core
Class PsyReader
- java.lang.Object
-
- coneforest.psylla.core.PsyReader
-
- All Implemented Interfaces:
PsyCloseable
,PsyConvertableToName
,PsyConvertableToString
,PsyEvaluable
,PsyObject
,PsyReadable
,PsyResetable
- Direct Known Subclasses:
PsyFileReader
,PsyStringReader
public class PsyReader extends Object implements PsyCloseable, PsyEvaluable, PsyReadable, PsyResetable
-
-
Field Summary
Fields Modifier and Type Field Description static String
LINE_SEPARATOR
-
Constructor Summary
Constructors Constructor Description PsyReader(InputStream is)
PsyReader(Reader reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
eval(Interpreter interpreter)
Evaluate this object in the context of given interpreter.void
psyClose()
Close this object.PsyString
psyReadLine()
Read a line (Ψ-string
) from this object and returns it.PsyString
psyReadString(PsyInteger oCount)
Read a Ψ-string
from this object and returns it.PsyBoolean
psyReady()
Returns a Ψ-boolean
indicating whether this object is ready to be read.void
psyReset()
Reset this object.PsyBoolean
psySkip(PsyInteger oCount)
Skips characters.int
read()
Reader
reader()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToName, psyToString, psyType, toSyntaxString, typeName
-
Methods inherited from interface coneforest.psylla.core.PsyReadable
psyRead
-
-
-
-
Field Detail
-
LINE_SEPARATOR
public static final String LINE_SEPARATOR
-
-
Constructor Detail
-
PsyReader
public PsyReader(Reader reader)
-
PsyReader
public PsyReader(InputStream is)
-
-
Method Detail
-
eval
public void eval(Interpreter interpreter) throws PsyException
Description copied from interface:PsyEvaluable
Evaluate this object in the context of given interpreter.- Specified by:
eval
in interfacePsyEvaluable
- Parameters:
interpreter
- an interpreter.- Throws:
PsyException
- when an error occurs durind evaluation of this object.
-
reader
public Reader reader()
-
read
public int read() throws PsyException
- Specified by:
read
in interfacePsyReadable
- Throws:
PsyException
-
psyReadString
public PsyString psyReadString(PsyInteger oCount) throws PsyException
Description copied from interface:PsyReadable
Read a Ψ-string
from this object and returns it.- Specified by:
psyReadString
in interfacePsyReadable
- Parameters:
oCount
- a Ψ-integer
representing the length of the string.- Returns:
- a string read.
- Throws:
PsyException
- when error occurs.
-
psyReadLine
public PsyString psyReadLine() throws PsyException
Description copied from interface:PsyReadable
Read a line (Ψ-string
) from this object and returns it.- Specified by:
psyReadLine
in interfacePsyReadable
- Returns:
- a line read,
- Throws:
PsyException
- when error occurs.
-
psySkip
public PsyBoolean psySkip(PsyInteger oCount) throws PsyException
Description copied from interface:PsyReadable
Skips characters. This method will block until some characters are available, an I/O error occurs, or end of input is reached.- Specified by:
psySkip
in interfacePsyReadable
- Parameters:
oCount
- a Ψ-integer
representing the number of characters to be skipped.- Returns:
- a Ψ-
boolean
indicating whether all the characters were skipped successfully - Throws:
PsyException
- when an error occurs.
-
psyReady
public PsyBoolean psyReady() throws PsyException
Description copied from interface:PsyReadable
Returns a Ψ-boolean
indicating whether this object is ready to be read.- Specified by:
psyReady
in interfacePsyReadable
- Returns:
true
if this object is ready to be read, andfalse
otherwise.- Throws:
PsyException
- when I/O error occurs.
-
psyClose
public void psyClose() throws PsyException
Description copied from interface:PsyCloseable
Close this object.- Specified by:
psyClose
in interfacePsyCloseable
- Throws:
PsyException
- when error occured during closing.
-
psyReset
public void psyReset() throws PsyException
Description copied from interface:PsyResetable
Reset this object.- Specified by:
psyReset
in interfacePsyResetable
- Throws:
PsyException
- when error occured during reset.
-
-