Class OtpInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class OtpInputStream
    extends java.io.ByteArrayInputStream
    Provides a stream for decoding Erlang terms from external format.

    Note that this class is not synchronized, if you need synchronization you must provide it yourself.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DECODE_INT_LISTS_AS_STRINGS  
      • Fields inherited from class java.io.ByteArrayInputStream

        buf, count, mark, pos
    • Constructor Summary

      Constructors 
      Constructor Description
      OtpInputStream​(byte[] buf)  
      OtpInputStream​(byte[] buf, int flags)
      Create a stream from a buffer containing encoded Erlang terms.
      OtpInputStream​(byte[] buf, int offset, int length, int flags)
      Create a stream from a buffer containing encoded Erlang terms at the given offset and length.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static long byte_array_to_long​(byte[] b, boolean unsigned)  
      int getPos()
      Get the current position in the stream.
      int peek()
      Alias for peek1()
      int peek1()
      Look ahead one position in the stream without consuming the byte found there.
      int peek1skip_version()  
      OtpErlangObject read_any()
      Read an arbitrary Erlang term from the stream.
      java.lang.String read_atom()
      Read an Erlang atom from the stream.
      byte[] read_binary()
      Read an Erlang binary from the stream.
      byte[] read_bitstr​(int[] pad_bits)
      Read an Erlang bitstr from the stream.
      boolean read_boolean()
      Read an Erlang atom from the stream and interpret the value as a boolean.
      byte read_byte()
      Read one byte from the stream.
      char read_char()
      Read a character from the stream.
      OtpErlangObject read_compressed()
      Read a compressed term from the stream
      double read_double()
      Read an Erlang float from the stream.
      OtpErlangExternalFun read_external_fun()  
      float read_float()
      Read an Erlang float from the stream.
      OtpErlangFun read_fun()  
      int read_int()
      Read an integer from the stream.
      byte[] read_integer_byte_array()
      Read an integer from the stream.
      int read_list_head()
      Read a list header from the stream.
      long read_long()
      Read a long from the stream.
      long read_long​(boolean unsigned)  
      int read_map_head()  
      int read_nil()
      Read an empty list from the stream.
      OtpErlangPid read_pid()
      Read an Erlang PID from the stream.
      OtpErlangPort read_port()
      Read an Erlang port from the stream.
      OtpErlangRef read_ref()
      Read an Erlang reference from the stream.
      short read_short()
      Read a short from the stream.
      java.lang.String read_string()
      Read a string from the stream.
      int read_tuple_head()
      Read a tuple header from the stream.
      int read_uint()
      Read an unsigned integer from the stream.
      long read_ulong()
      Read an unsigned long from the stream.
      short read_ushort()
      Read an unsigned short from the stream.
      int read1()
      Read a one byte integer from the stream.
      int read1skip_version()  
      int read2BE()
      Read a two byte big endian integer from the stream.
      int read2LE()
      Read a two byte little endian integer from the stream.
      int read4BE()
      Read a four byte big endian integer from the stream.
      int read4LE()
      Read a four byte little endian integer from the stream.
      long read8BE()
      Read a eight byte big endian integer from the stream.
      long readBE​(int n)
      Read a bigendian integer from the stream.
      long readLE​(int n)
      Read a little endian integer from the stream.
      int readN​(byte[] abuf)
      Read an array of bytes from the stream.
      int readN​(byte[] abuf, int off, int len)
      Read an array of bytes from the stream.
      int setPos​(int pos)
      Set the current position in the stream.
      • Methods inherited from class java.io.ByteArrayInputStream

        available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.io.InputStream

        nullInputStream, read, readNBytes
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait