java.lang.Object
coneforest.psylla.core.PsyReader
- All Implemented Interfaces:
PsyCloseable,PsyEvaluable,PsyObject,PsyReadable,PsyReady,PsyResetable
- Direct Known Subclasses:
PsyFileReader,PsyStringReader
@Type("reader")
public class PsyReader
extends Object
implements PsyCloseable, PsyEvaluable, PsyReadable, PsyResetable
The representation of
reader.-
Field Summary
Fields inherited from interface coneforest.psylla.core.PsyCloseable
PSY_CLOSEFields inherited from interface coneforest.psylla.core.PsyEvaluable
PSY_EVALFields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TOSTRING, PSY_TOSTRINGBUFFER, PSY_TYPEFields inherited from interface coneforest.psylla.core.PsyReadable
LINE_SEPARATOR, PSY_READ, PSY_READLINE, PSY_READSTRING, PSY_SKIPFields inherited from interface coneforest.psylla.core.PsyResetable
PSY_RESET -
Constructor Summary
ConstructorsConstructorDescriptionPsyReader(InputStream is) Constructs a newreaderobject from the input stream.Constructs a newreaderobject from the reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidpsyClose()Closes this object.voidpsyEval(PsyContext oContext) Evaluate this object in the current context.psyReadString(PsyInteger oCount) Read astringfrom this object and returns it.psyReady()Returns abooleanobject indicating whether this object is ready to be read.voidpsyReset()Reset thisresetableobject.psySkip(PsyInteger oCount) Skips characters.intread()Reads a single character.reader()Returns theReaderobject backed by this object.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, toSyntaxString, typeNameMethods inherited from interface coneforest.psylla.core.PsyReadable
psyRead, psyReadLine
-
Constructor Details
-
PsyReader
Constructs a newreaderobject from the reader.- Parameters:
reader- the reader.
-
PsyReader
Constructs a newreaderobject from the input stream.- Parameters:
is- the input stream.
-
-
Method Details
-
psyEval
Description copied from interface:PsyEvaluableEvaluate this object in the current context.- Specified by:
psyEvalin interfacePsyEvaluable- Throws:
PsyErrorException- when an error occurs durind evaluation of this object.
-
reader
Returns theReaderobject backed by this object.- Returns:
- the
Readerobject backed by this object
-
read
Description copied from interface:PsyReadableReads a single character.- Specified by:
readin interfacePsyReadable- 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
-
psyReadString
public Optional<PsyString> psyReadString(PsyInteger oCount) throws PsyIOErrorException, PsyLimitCheckException, PsyRangeCheckException Description copied from interface:PsyReadableRead astringfrom this object and returns it.- Specified by:
psyReadStringin interfacePsyReadable- Parameters:
oCount- anintegerrepresenting the length of the string.- Returns:
- a string read.
- Throws:
PsyIOErrorException- when I/O error occurs.PsyLimitCheckExceptionPsyRangeCheckException
-
psySkip
Description copied from interface:PsyReadableSkips characters. This method will block until some characters are available, an I/O error occurs, or end of input is reached.- Specified by:
psySkipin interfacePsyReadable- 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
Description copied from interface:PsyReadableReturns abooleanobject indicating whether this object is ready to be read.- Specified by:
psyReadyin interfacePsyReadable- Specified by:
psyReadyin interfacePsyReady- Returns:
trueif this object is ready to be read, andfalseotherwise.- Throws:
PsyIOErrorException- when I/O error occurs.
-
psyClose
Description copied from interface:PsyCloseableCloses this object.- Specified by:
psyClosein interfacePsyCloseable- Throws:
PsyIOErrorException
-
psyReset
Description copied from interface:PsyResetableReset thisresetableobject.- Specified by:
psyResetin interfacePsyResetable- Throws:
PsyIOErrorException
-