- All Known Implementing Classes:
PsyFileReader
,PsyInput
,PsyReader
,PsyStringReader
The representation of
readable
, an object that can be treated as a source of characters
to read from.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ContextAction
Context action of theread
operator.static final ContextAction
Context action of theskip
operator.Fields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TONAME, PSY_TOSTRING, PSY_TYPE
-
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<PsyInteger>
psyRead()
Read aninteger
character from this object and returns it.Read a line (string
) from this object and returns it.psyReadString
(PsyInteger oCount) Read astring
from this object and returns it.psyReady()
Returns aboolean
object indicating whether this object is ready to be read.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
-
Field Details
-
PSY_SKIP
Context action of theskip
operator. -
PSY_READ
Context action of theread
operator.
-
-
Method Details
-
read
- Throws:
PsyIOErrorException
-
psyRead
Read aninteger
character from this object and returns it. ReturnsPsyInteger.MINUS_ONE
when end of input has been reached. TODO- Returns:
- an
integer
representing the character read from this object. - Throws:
PsyIOErrorException
- when I/O error occurs.
-
psyReadString
PsyString psyReadString(PsyInteger oCount) throws PsyIOErrorException, PsyLimitCheckException, PsyRangeCheckException, PsyUnsupportedException Read astring
from this object and returns it.- Parameters:
oCount
- aninteger
representing the length of the string.- Returns:
- a string read.
- Throws:
PsyIOErrorException
- when I/O error occurs.PsyLimitCheckException
PsyRangeCheckException
PsyUnsupportedException
-
psyReadLine
Read a line (string
) from this object and returns it.- Returns:
- a line read.
- Throws:
PsyIOErrorException
- when I/O error occurs.PsyUnsupportedException
-
psySkip
Skips characters. This method will block until some characters are available, an I/O error occurs, or end of input is reached.- Parameters:
oCount
- aninteger
representing the number of characters to be skipped.- Returns:
- an
integer
representing the number of characters actually skipped. - Throws:
PsyIOErrorException
- when I/O error occurs.PsyRangeCheckException
-
psyReady
Returns aboolean
object indicating whether this object is ready to be read.- Specified by:
psyReady
in interfacePsyReady
- Returns:
true
if this object is ready to be read, andfalse
otherwise.- Throws:
PsyIOErrorException
- when I/O error occurs.
-