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 enumstatic classClass to abstract readtable access Many of the functions below (used to) exist in 2 variants. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Primitiveprotected intThe number of characters on the current line of output Used to determine whether additional line feeds are required when calling FRESH-LINEstatic Stream.ReadtableAccessorpre-instantiated readtable accessor for the *readtable*.protected LispObjectprotected Stringprotected charprotected Stream.EolStyleprotected LispObjectstatic Stream.ReadtableAccessorpre-instantiated readtable accessor for the fasl readtable.protected booleanprotected booleanprotected booleanprotected booleanprotected static final Symbolprotected charprotected intprotected intstatic final Primitivestatic final Stream.EolStyleprotected PushbackReaderstatic final Primitivestatic final Primitive -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStream(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 booleanprotected booleanReturns a boolean indicating input readily availablevoidReads all input from the underlying stream, until _charReady() indicates no more input to be availablevoid_close()Closes the stream and underlying streamsvoidFlushes any buffered output in the (underlying) streamprotected longReturns a (non-negative) file position integer or a negative value if the position cannot be determined.intReads an 8-bit byte off the underlying streamprotected intReads a character off an underlying streamprotected booleanSets 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 sovoidWrites 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 otherwiseintintintprotected voidprotected voidprotected voidinitAsCharacterInputStream(Reader reader) protected voidinitAsCharacterOutputStream(Writer writer) static final StringbooleanbooleanbooleanbooleanbooleanbooleanbooleanisOpen()booleanlisten()voidprin1(LispObject obj) voidprint(char c) voidread(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) voidsetCharPos(int n) voidsetExternalFormat(LispObject format) voidsetInteractive(boolean b) voidsetOpen(boolean b) protected voidvoidprotected LispObjectprotected LispObjectprotected LispObjectprotected LispObjectprotected LispObjectterpri()typeOf()typep(LispObject typeSpecifier) Methods inherited from class 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_VALUEMethods inherited from class 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:
typeOfin classStructureObject
-
classOf
- Overrides:
classOfin classStructureObject
-
typep
- Overrides:
typepin 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
-