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
FieldsFields inherited from interface coneforest.psylla.core.PsyCloseable
PSY_CLOSE
Fields inherited from interface coneforest.psylla.core.PsyEvaluable
PSY_EVAL
Fields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TOSTRING, PSY_TOSTRINGBUFFER, PSY_TYPE
Fields inherited from interface coneforest.psylla.core.PsyReadable
PSY_READ, PSY_SKIP
Fields inherited from interface coneforest.psylla.core.PsyResetable
PSY_RESET
-
Constructor Summary
ConstructorsConstructorDescriptionPsyReader
(InputStream is) Constructs a newreader
object from the input stream.Constructs a newreader
object from the reader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
psyClose()
Closes this object.void
psyEval
(PsyContext oContext) Evaluate this object in the current context.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.void
psyReset()
Reset thisresetable
object.psySkip
(PsyInteger oCount) Skips characters.int
read()
Reads a single character.reader()
Returns theReader
object backed by this object.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, psyToString, psyToStringBuffer, psyType, toSyntaxString, typeName
Methods inherited from interface coneforest.psylla.core.PsyReadable
psyRead
-
Field Details
-
LINE_SEPARATOR
Line separator string.
-
-
Constructor Details
-
PsyReader
Constructs a newreader
object from the reader.- Parameters:
reader
- the reader.
-
PsyReader
Constructs a newreader
object from the input stream.- Parameters:
is
- the input stream.
-
-
Method Details
-
psyEval
Description copied from interface:PsyEvaluable
Evaluate this object in the current context.- Specified by:
psyEval
in interfacePsyEvaluable
- Throws:
PsyErrorException
- when an error occurs durind evaluation of this object.
-
reader
Returns theReader
object backed by this object.- Returns:
- the
Reader
object backed by this object
-
read
Description copied from interface:PsyReadable
Reads a single character.- Specified by:
read
in 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:
PsyIOErrorException
- when an I/O error occurs.
-
psyReadString
public PsyStringBuffer psyReadString(PsyInteger oCount) throws PsyIOErrorException, PsyLimitCheckException, PsyRangeCheckException Description copied from interface:PsyReadable
Read astring
from this object and returns it.- Specified by:
psyReadString
in interfacePsyReadable
- Parameters:
oCount
- aninteger
representing the length of the string.- Returns:
- a string read.
- Throws:
PsyIOErrorException
- when I/O error occurs.PsyLimitCheckException
PsyRangeCheckException
-
psyReadLine
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:
PsyIOErrorException
- when I/O error occurs.
-
psySkip
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
- 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
Description copied from interface:PsyReadable
Returns aboolean
object indicating whether this object is ready to be read.- Specified by:
psyReady
in interfacePsyReadable
- Specified by:
psyReady
in interfacePsyReady
- Returns:
true
if this object is ready to be read, andfalse
otherwise.- Throws:
PsyIOErrorException
- when I/O error occurs.
-
psyClose
Description copied from interface:PsyCloseable
Closes this object.- Specified by:
psyClose
in interfacePsyCloseable
- Throws:
PsyIOErrorException
-
psyReset
Description copied from interface:PsyResetable
Reset thisresetable
object.- Specified by:
psyReset
in interfacePsyResetable
- Throws:
PsyIOErrorException
-