- All Known Implementing Classes:
PsyFileInput,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 StringLine separator string.static final ContextActionContext action of thereadoperator.static final ContextActionContext action of thereadlineoperator.static final ContextActionContext action of thereadstringoperator.static final ContextActionContext action of theskipoperator.Fields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TOSTRING, PSY_TOSTRINGBUFFER, PSY_TYPE -
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<PsyInteger> psyRead()Read anintegercharacter from this object and returns it.Read a line (string) from this object and returns it.psyReadString(PsyInteger oCount) Read astringfrom this object and returns it.psyReady()Returns abooleanobject indicating whether this object is ready to be read.psySkip(PsyInteger oCount) Skips characters.intread()Reads a single character.Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, toSyntaxString, typeName
-
Field Details
-
PSY_SKIP
Context action of theskipoperator. -
PSY_READ
Context action of thereadoperator. -
PSY_READLINE
Context action of thereadlineoperator. -
PSY_READSTRING
Context action of thereadstringoperator. -
LINE_SEPARATOR
Line separator string.
-
-
Method Details
-
read
Reads a single character.- Returns:
- the character read, as an integer in the range 0 to 65535 (
0x00–0xFFFF), or -1 if the end of the source has been reached. - Throws:
IOException- when an I/O error occurs.IOError
-
psyRead
Read anintegercharacter from this object and returns it. ReturnsPsyInteger.MINUS_ONEwhen end of input has been reached. TODO- Returns:
- an
integerrepresenting the character read from this object. - Throws:
PsyIOErrorException- when an I/O error occurs.
-
psyReadString
Optional<PsyString> psyReadString(PsyInteger oCount) throws PsyIOErrorException, PsyLimitCheckException, PsyRangeCheckException, PsyUnsupportedException Read astringfrom this object and returns it.- Parameters:
oCount- anintegerrepresenting the length of the string.- Returns:
- a string read.
- Throws:
PsyIOErrorException- when I/O error occurs.PsyLimitCheckExceptionPsyRangeCheckExceptionPsyUnsupportedException
-
psyReadLine
Read a line (string) from this object and returns it.- Returns:
- a line read.
- Throws:
PsyIOErrorException- when I/O error occurs.
-
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- anintegerrepresenting the number of characters to be skipped.- Returns:
- an
integerrepresenting the number of characters actually skipped. - Throws:
PsyIOErrorException- when I/O error occurs.PsyRangeCheckException
-
psyReady
Returns abooleanobject indicating whether this object is ready to be read.- Specified by:
psyReadyin interfacePsyReady- Returns:
trueif this object is ready to be read, andfalseotherwise.- Throws:
PsyIOErrorException- when I/O error occurs.
-