Package org.armedbear.lisp
Class Stream
java.lang.Object
org.armedbear.lisp.LispObject
org.armedbear.lisp.StructureObject
org.armedbear.lisp.Stream
- Direct Known Subclasses:
BroadcastStream
,ByteArrayInputStream
,ByteArrayOutputStream
,CaseFrobStream
,ConcatenatedStream
,EchoStream
,FileStream
,FillPointerOutputStream
,GrayStream
,JarStream
,SlimeInputStream
,SlimeOutputStream
,StringInputStream
,StringOutputStream
,SynonymStream
,TwoWayStream
,URLStream
The stream class
A base class for all Lisp built-in streams.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static class
Class to abstract readtable access Many of the functions below (used to) exist in 2 variants. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Primitive
protected int
The number of characters on the current line of output Used to determine whether additional line feeds are required when calling FRESH-LINEstatic Stream.ReadtableAccessor
pre-instantiated readtable accessor for the *readtable*.protected LispObject
protected String
protected char
protected Stream.EolStyle
protected LispObject
static Stream.ReadtableAccessor
pre-instantiated readtable accessor for the fasl readtable.protected boolean
protected boolean
protected boolean
protected boolean
protected static final Symbol
protected char
protected int
protected int
static final Primitive
static final Stream.EolStyle
protected PushbackReader
static final Primitive
static final Primitive
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Stream
(Symbol structureClass, InputStream stream) Stream
(Symbol structureClass, InputStream inputStream, LispObject elementType) Stream
(Symbol structureClass, InputStream inputStream, LispObject elementType, boolean interactive) Stream
(Symbol structureClass, InputStream inputStream, LispObject elementType, LispObject format) Stream
(Symbol structureClass, OutputStream stream) Stream
(Symbol structureClass, OutputStream outputStream, LispObject elementType) Stream
(Symbol structureClass, OutputStream outputStream, LispObject elementType, boolean interactive) Stream
(Symbol structureClass, OutputStream outputStream, LispObject elementType, LispObject format) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected boolean
Returns a boolean indicating input readily availablevoid
Reads all input from the underlying stream, until _charReady() indicates no more input to be availablevoid
_close()
Closes the stream and underlying streamsvoid
Flushes any buffered output in the (underlying) streamprotected long
Returns a (non-negative) file position integer or a negative value if the position cannot be determined.int
Reads an 8-bit byte off the underlying streamprotected int
Reads a character off an underlying streamprotected boolean
Sets the file position based on a position designator passed in argprotected void
_unreadChar
(int n) Puts a character back into the (underlying) streamvoid
_writeByte
(int n) Writes an 8-bit byte off the underlying streamvoid
_writeChar
(char c) Writes a character into the underlying stream, updating charPos while doing sovoid
_writeChars
(char[] chars, int start, int end) Writes a series of characters in the underlying stream, updating charPos while doing sovoid
_writeLine
(String s) Writes a string to the underlying stream, appending a new line and updating charPos while doing sovoid
Writes a string to the underlying stream, updating charPos while doing soclassOf()
close
(LispObject abort) Emit a newline unless at character position zero Return T if newline was emitted, NIL otherwiseint
int
int
protected void
protected void
protected void
initAsCharacterInputStream
(Reader reader) protected void
initAsCharacterOutputStream
(Writer writer) static final String
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isOpen()
boolean
listen()
void
prin1
(LispObject obj) void
print
(char c) void
read
(boolean eofError, LispObject eofValue, boolean recursive, LispThread thread, Stream.ReadtableAccessor rta) readArray
(int rank, Stream.ReadtableAccessor rta) readByte
(boolean eofError, LispObject eofValue) readChar()
readChar
(boolean eofError, LispObject eofValue) readCharacterLiteral
(Readtable rt, LispThread thread) readCharNoHang
(boolean eofError, LispObject eofValue) readDelimitedList
(char delimiter) readDispatchChar
(char dispChar, Stream.ReadtableAccessor rta) readLine
(boolean eofError, LispObject eofValue) readList
(boolean requireProperList, Stream.ReadtableAccessor rta) readPreservingWhitespace
(boolean eofError, LispObject eofValue, boolean recursive, LispThread thread, Stream.ReadtableAccessor rta) readRadix
(int radix, Stream.ReadtableAccessor rta) readSharpDot
(char c, int n, Stream.ReadtableAccessor rta) readSharpLeftParen
(char c, int n, Stream.ReadtableAccessor rta) readSharpStar
(char ignored, int n, Stream.ReadtableAccessor rta) readString
(char terminator, Stream.ReadtableAccessor rta) readSymbol
(Readtable rt) void
setCharPos
(int n) void
setExternalFormat
(LispObject format) void
setInteractive
(boolean b) void
setOpen
(boolean b) protected void
void
protected LispObject
protected LispObject
protected LispObject
protected LispObject
protected LispObject
terpri()
typeOf()
typep
(LispObject typeSpecifier) Methods inherited from class org.armedbear.lisp.StructureObject
equalp, getFixnumSlotValue, getParts, getSlotIndex, getSlotValue, getSlotValue_0, getSlotValue_1, getSlotValue_2, getSlotValue_3, getSlotValueAsBoolean, printObject, psxhash, psxhash, setSlotValue, setSlotValue, setSlotValue_0, setSlotValue_1, setSlotValue_2, setSlotValue_3, SLOT_VALUE
Methods inherited from class org.armedbear.lisp.LispObject
ABS, add, add, aref, AREF, AREF, aref_long, aset, aset, aset, ash, ash, atom, ATOM, caddr, cadr, car, cddr, cdr, CHAR, characterp, CHARACTERP, chars, COMPLEXP, constantp, CONSTANTP, copyToArray, decr, DENOMINATOR, dispatch, divideBy, doubleValue, elt, endp, ENDP, EQ, eql, eql, eql, EQL, equal, equal, EQUAL, equalp, evenp, EVENP, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, floatp, FLOATP, floatValue, getBooleanValue, getCallCount, getDescription, getDocumentation, getHotCount, getInstance, getPropertyList, getStringChars, getStringValue, getSymbolFunction, getSymbolFunctionOrDie, getSymbolSetfFunction, getSymbolSetfFunctionOrDie, getSymbolValue, incr, incrementCallCount, incrementHotCount, integerp, INTEGERP, intValue, IS_E, IS_GE, IS_GT, IS_LE, IS_LT, IS_NE, isEqualTo, isEqualTo, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo, isNotEqualTo, isNotEqualTo, isSpecialOperator, isSpecialVariable, javaInstance, javaInstance, LDB, length, LENGTH, listp, LISTP, lockableInstance, LOGAND, LOGAND, LOGIOR, LOGIOR, LOGNOT, LOGXOR, LOGXOR, longValue, minusp, MINUSP, MOD, MOD, multiplyBy, multiplyBy, negate, noFillPointer, NOT, nreverse, NTH, NTH, nthcdr, numberp, NUMBERP, NUMERATOR, oddp, ODDP, plusp, PLUSP, princToString, push, rationalp, RATIONALP, realp, REALP, resolve, reverse, RPLACA, RPLACD, SCHAR, setCallCount, setCar, setCdr, setDocumentation, setHotCount, setPropertyList, SIMPLE_STRING_P, STRING, stringp, STRINGP, subtract, subtract, SVREF, svset, sxhash, SYMBOLP, truncate, unreadableString, unreadableString, VECTOR_PUSH_EXTEND, VECTOR_PUSH_EXTEND, vectorp, VECTORP, vectorPushExtend, zerop, ZEROP
-
Field Details
-
elementType
-
isInputStream
protected boolean isInputStream -
isOutputStream
protected boolean isOutputStream -
isCharacterStream
protected boolean isCharacterStream -
isBinaryStream
protected boolean isBinaryStream -
reader
-
offset
protected int offset -
lineNumber
protected int lineNumber -
charPos
protected int charPosThe number of characters on the current line of output Used to determine whether additional line feeds are required when calling FRESH-LINE -
keywordDefault
-
platformEolStyle
-
eolStyle
-
eolChar
protected char eolChar -
externalFormat
-
encoding
-
lastChar
protected char lastChar -
STREAM_EXTERNAL_FORMAT
-
SET_STREAM_EXTERNAL_FORMAT
-
AVAILABLE_ENCODINGS
-
currentReadtable
pre-instantiated readtable accessor for the *readtable*. -
faslReadtable
pre-instantiated readtable accessor for the fasl readtable. -
OUT_SYNONYM_OF
-
-
Constructor Details
-
Stream
-
Stream
-
Stream
-
Stream
-
Stream
-
Stream
-
Stream
public Stream(Symbol structureClass, InputStream inputStream, LispObject elementType, LispObject format) -
Stream
public Stream(Symbol structureClass, InputStream inputStream, LispObject elementType, boolean interactive) -
Stream
-
Stream
public Stream(Symbol structureClass, OutputStream outputStream, LispObject elementType, LispObject format) -
Stream
public Stream(Symbol structureClass, OutputStream outputStream, LispObject elementType, boolean interactive)
-
-
Method Details
-
initAsCharacterInputStream
-
initAsBinaryInputStream
-
initAsCharacterOutputStream
-
initAsBinaryOutputStream
-
isInputStream
public boolean isInputStream() -
isOutputStream
public boolean isOutputStream() -
isCharacterInputStream
public boolean isCharacterInputStream() -
isBinaryInputStream
public boolean isBinaryInputStream() -
isCharacterOutputStream
public boolean isCharacterOutputStream() -
isBinaryOutputStream
public boolean isBinaryOutputStream() -
isInteractive
public boolean isInteractive() -
setInteractive
public void setInteractive(boolean b) -
getExternalFormat
-
getEncoding
-
setExternalFormat
-
availableEncodings
-
isOpen
public boolean isOpen() -
setOpen
public void setOpen(boolean b) -
typeOf
- Overrides:
typeOf
in classStructureObject
-
classOf
- Overrides:
classOf
in classStructureObject
-
typep
- Overrides:
typep
in classStructureObject
-
getElementType
-
getOffset
public int getOffset() -
getLineNumber
public int getLineNumber() -
setWriter
-
getCharPos
public int getCharPos() -
setCharPos
public void setCharPos(int n) -
read
public LispObject read(boolean eofError, LispObject eofValue, boolean recursive, LispThread thread, Stream.ReadtableAccessor rta) -
readPreservingWhitespace
public LispObject readPreservingWhitespace(boolean eofError, LispObject eofValue, boolean recursive, LispThread thread, Stream.ReadtableAccessor rta) -
readPathname
-
readSymbol
-
readSymbol
-
readStructure
-
readString
-
readList
-
readDispatchChar
-
readSharpLeftParen
-
readSharpStar
-
readSharpDot
-
readCharacterLiteral
-
skipBalancedComment
public void skipBalancedComment() -
readArray
-
readComplex
-
invert
-
readRadix
-
readDelimitedList
-
readLine
-
readChar
-
readChar
-
readCharNoHang
-
unreadChar
-
finishOutput
-
clearInput
-
getFilePosition
-
setFilePosition
-
close
-
readByte
-
terpri
-
freshLine
Emit a newline unless at character position zero Return T if newline was emitted, NIL otherwise -
print
public void print(char c) -
prin1
-
listen
-
fileLength
-
fileStringLength
-
_readChar
Reads a character off an underlying stream- Returns:
- a character, or -1 at end-of-file
- Throws:
IOException
-
_unreadChar
Puts a character back into the (underlying) stream- Parameters:
n
-- Throws:
IOException
-
_charReady
Returns a boolean indicating input readily available- Returns:
- true if a character is available
- Throws:
IOException
-
_byteReady
- Throws:
IOException
-
_writeChar
public void _writeChar(char c) Writes a character into the underlying stream, updating charPos while doing so- Parameters:
c
-
-
_writeChars
public void _writeChars(char[] chars, int start, int end) Writes a series of characters in the underlying stream, updating charPos while doing so- Parameters:
chars
-start
-end
-
-
_writeString
Writes a string to the underlying stream, updating charPos while doing so- Parameters:
s
-
-
_writeLine
Writes a string to the underlying stream, appending a new line and updating charPos while doing so- Parameters:
s
-
-
_readByte
public int _readByte()Reads an 8-bit byte off the underlying stream- Returns:
-
_writeByte
public void _writeByte(int n) Writes an 8-bit byte off the underlying stream- Parameters:
n
-
-
_finishOutput
public void _finishOutput()Flushes any buffered output in the (underlying) stream -
_clearInput
public void _clearInput()Reads all input from the underlying stream, until _charReady() indicates no more input to be available -
_getFilePosition
protected long _getFilePosition()Returns a (non-negative) file position integer or a negative value if the position cannot be determined.- Returns:
- non-negative value as a position spec
-
_setFilePosition
Sets the file position based on a position designator passed in arg- Parameters:
arg
- File position specifier as described in the CLHS- Returns:
- true on success, false on failure
-
_close
public void _close()Closes the stream and underlying streams -
printStackTrace
-
streamNotInputStream
-
streamNotCharacterInputStream
-
streamNotOutputStream
-
streamNotBinaryOutputStream
-
streamNotCharacterOutputStream
-
getWrappedInputStream
-
getWrappedOutputStream
-
getWrappedWriter
-
getWrappedReader
-