Package coneforest.psylla.core
Interface PsyReadable
-
- All Superinterfaces:
PsyConvertableToName
,PsyConvertableToString
,PsyObject
- All Known Implementing Classes:
PsyFileReader
,PsyInput
,PsyReader
,PsyStringReader
public interface PsyReadable extends PsyObject
A representation of Ψ-readable
, a type of objects that can be treated as a source of characters.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default PsyInteger
psyRead()
Read a character (Ψ-integer
) from this object and returns it.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.PsyBoolean
psySkip(PsyInteger oCount)
Skips characters.int
read()
-
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToName, psyToString, psyType, toSyntaxString, typeName
-
-
-
-
Method Detail
-
read
int read() throws PsyException
- Throws:
PsyException
-
psyRead
default PsyInteger psyRead() throws PsyException
Read a character (Ψ-integer
) from this object and returns it. ReturnsPsyInteger.MINUS_ONE
when end of input has been reached.- Returns:
- a Ψ-
integer
representing the character read from this object. - Throws:
PsyException
- when error occurs.
-
psyReadString
PsyString psyReadString(PsyInteger oCount) throws PsyException
Read a Ψ-string
from this object and returns it.- Parameters:
oCount
- a Ψ-integer
representing the length of the string.- Returns:
- a string read.
- Throws:
PsyException
- when error occurs.
-
psyReadLine
PsyString psyReadLine() throws PsyException
Read a line (Ψ-string
) from this object and returns it.- Returns:
- a line read,
- Throws:
PsyException
- when error occurs.
-
psySkip
PsyBoolean psySkip(PsyInteger oCount) throws PsyException
Skips characters. This method will block until some characters are available, an I/O error occurs, or end of input is reached.- 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
PsyBoolean psyReady() throws PsyException
Returns a Ψ-boolean
indicating whether this object is ready to be read.- Returns:
true
if this object is ready to be read, andfalse
otherwise.- Throws:
PsyException
- when I/O error occurs.
-
-