Class Stream

Direct Known Subclasses:
BroadcastStream, ByteArrayInputStream, ByteArrayOutputStream, CaseFrobStream, ConcatenatedStream, EchoStream, FileStream, FillPointerOutputStream, GrayStream, JarStream, SlimeInputStream, SlimeOutputStream, StringInputStream, StringOutputStream, SynonymStream, TwoWayStream, URLStream

public class Stream extends StructureObject
The stream class A base class for all Lisp built-in streams.
  • Field Details

    • elementType

      protected LispObject elementType
    • isInputStream

      protected boolean isInputStream
    • isOutputStream

      protected boolean isOutputStream
    • isCharacterStream

      protected boolean isCharacterStream
    • isBinaryStream

      protected boolean isBinaryStream
    • reader

      protected PushbackReader reader
    • offset

      protected int offset
    • lineNumber

      protected int lineNumber
    • charPos

      protected int charPos
      The number of characters on the current line of output Used to determine whether additional line feeds are required when calling FRESH-LINE
    • keywordDefault

      protected static final Symbol keywordDefault
    • platformEolStyle

      public static final Stream.EolStyle platformEolStyle
    • eolStyle

      protected Stream.EolStyle eolStyle
    • eolChar

      protected char eolChar
    • externalFormat

      protected LispObject externalFormat
    • encoding

      protected String encoding
    • lastChar

      protected char lastChar
    • STREAM_EXTERNAL_FORMAT

      public static final Primitive STREAM_EXTERNAL_FORMAT
    • SET_STREAM_EXTERNAL_FORMAT

      public static final Primitive SET_STREAM_EXTERNAL_FORMAT
    • AVAILABLE_ENCODINGS

      public static final Primitive AVAILABLE_ENCODINGS
    • currentReadtable

      public static Stream.ReadtableAccessor currentReadtable
      pre-instantiated readtable accessor for the *readtable*.
    • faslReadtable

      public static Stream.ReadtableAccessor faslReadtable
      pre-instantiated readtable accessor for the fasl readtable.
    • OUT_SYNONYM_OF

      public static final Primitive OUT_SYNONYM_OF
  • Constructor Details

  • Method Details

    • initAsCharacterInputStream

      protected void initAsCharacterInputStream(Reader reader)
    • initAsBinaryInputStream

      protected void initAsBinaryInputStream(InputStream in)
    • initAsCharacterOutputStream

      protected void initAsCharacterOutputStream(Writer writer)
    • initAsBinaryOutputStream

      protected void initAsBinaryOutputStream(OutputStream out)
    • 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

      public LispObject getExternalFormat()
    • getEncoding

      public String getEncoding()
    • setExternalFormat

      public void setExternalFormat(LispObject format)
    • availableEncodings

      public static List<Symbol> availableEncodings()
    • isOpen

      public boolean isOpen()
    • setOpen

      public void setOpen(boolean b)
    • typeOf

      public LispObject typeOf()
      Overrides:
      typeOf in class StructureObject
    • classOf

      public LispObject classOf()
      Overrides:
      classOf in class StructureObject
    • typep

      public LispObject typep(LispObject typeSpecifier)
      Overrides:
      typep in class StructureObject
    • getElementType

      public LispObject getElementType()
    • getOffset

      public int getOffset()
    • getLineNumber

      public int getLineNumber()
    • setWriter

      protected void setWriter(Writer writer)
    • 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

      public LispObject readPathname(Stream.ReadtableAccessor rta)
    • readSymbol

      public LispObject readSymbol()
    • readSymbol

      public LispObject readSymbol(Readtable rt)
    • readStructure

      public LispObject readStructure(Stream.ReadtableAccessor rta)
    • readString

      public LispObject readString(char terminator, Stream.ReadtableAccessor rta)
    • readList

      public LispObject readList(boolean requireProperList, Stream.ReadtableAccessor rta)
    • readDispatchChar

      public LispObject readDispatchChar(char dispChar, Stream.ReadtableAccessor rta)
    • readSharpLeftParen

      public LispObject readSharpLeftParen(char c, int n, Stream.ReadtableAccessor rta)
    • readSharpStar

      public LispObject readSharpStar(char ignored, int n, Stream.ReadtableAccessor rta)
    • readSharpDot

      public LispObject readSharpDot(char c, int n, Stream.ReadtableAccessor rta)
    • readCharacterLiteral

      public LispObject readCharacterLiteral(Readtable rt, LispThread thread)
    • skipBalancedComment

      public void skipBalancedComment()
    • readArray

      public LispObject readArray(int rank, Stream.ReadtableAccessor rta)
    • readComplex

      public LispObject readComplex(Stream.ReadtableAccessor rta)
    • invert

      public static final String invert(String s, BitSet flags)
    • readRadix

      public LispObject readRadix(int radix, Stream.ReadtableAccessor rta)
    • readDelimitedList

      public LispObject readDelimitedList(char delimiter)
    • readLine

      public LispObject readLine(boolean eofError, LispObject eofValue)
    • readChar

      public LispObject readChar()
    • readChar

      public LispObject readChar(boolean eofError, LispObject eofValue)
    • readCharNoHang

      public LispObject readCharNoHang(boolean eofError, LispObject eofValue)
    • unreadChar

      public LispObject unreadChar(LispCharacter c)
    • finishOutput

      public LispObject finishOutput()
    • clearInput

      public LispObject clearInput()
    • getFilePosition

      public LispObject getFilePosition()
    • setFilePosition

      public LispObject setFilePosition(LispObject arg)
    • close

      public LispObject close(LispObject abort)
    • readByte

      public LispObject readByte(boolean eofError, LispObject eofValue)
    • terpri

      public LispObject terpri()
    • freshLine

      public LispObject freshLine()
      Emit a newline unless at character position zero Return T if newline was emitted, NIL otherwise
    • print

      public void print(char c)
    • prin1

      public void prin1(LispObject obj)
    • listen

      public LispObject listen()
    • fileLength

      public LispObject fileLength()
    • fileStringLength

      public LispObject fileStringLength(LispObject arg)
    • _readChar

      protected int _readChar() throws IOException
      Reads a character off an underlying stream
      Returns:
      a character, or -1 at end-of-file
      Throws:
      IOException
    • _unreadChar

      protected void _unreadChar(int n) throws IOException
      Puts a character back into the (underlying) stream
      Parameters:
      n -
      Throws:
      IOException
    • _charReady

      protected boolean _charReady() throws IOException
      Returns a boolean indicating input readily available
      Returns:
      true if a character is available
      Throws:
      IOException
    • _byteReady

      protected boolean _byteReady() throws IOException
      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

      public void _writeString(String s)
      Writes a string to the underlying stream, updating charPos while doing so
      Parameters:
      s -
    • _writeLine

      public void _writeLine(String s)
      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

      protected boolean _setFilePosition(LispObject arg)
      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

      public void printStackTrace(Throwable t)
    • streamNotInputStream

      protected LispObject streamNotInputStream()
    • streamNotCharacterInputStream

      protected LispObject streamNotCharacterInputStream()
    • streamNotOutputStream

      protected LispObject streamNotOutputStream()
    • streamNotBinaryOutputStream

      protected LispObject streamNotBinaryOutputStream()
    • streamNotCharacterOutputStream

      protected LispObject streamNotCharacterOutputStream()
    • getWrappedInputStream

      public InputStream getWrappedInputStream()
    • getWrappedOutputStream

      public OutputStream getWrappedOutputStream()
    • getWrappedWriter

      public Writer getWrappedWriter()
    • getWrappedReader

      public PushbackReader getWrappedReader()