Class Intercom.RingBuffer.OutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Enclosing class:
    Intercom.RingBuffer

    class Intercom.RingBuffer.OutputStream
    extends java.io.OutputStream
    implements java.lang.AutoCloseable
    An OutputStream to write data to this buffer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean closedFlag
      Flag to mark a closed stream
    • Constructor Summary

      Constructors 
      Constructor Description
      OutputStream()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this stream.
      void write​(byte[] buf)
      Write the contents of the byte array to the buffer.
      void write​(byte[] buf, int off, int len)
      Write bytes from a byte array to this stream.
      void write​(int b)
      Write a single byte to the buffer.
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • closedFlag

        private volatile boolean closedFlag
        Flag to mark a closed stream
    • Constructor Detail

      • OutputStream

        OutputStream()
    • Method Detail

      • write

        public void write​(int b)
                   throws java.io.IOException
        Write a single byte to the buffer.
        Specified by:
        write in class java.io.OutputStream
        Parameters:
        b - byte to be written
        Throws:
        java.io.IOException - if an error occurs
      • write

        public void write​(byte[] buf,
                          int off,
                          int len)
                   throws java.io.IOException
        Write bytes from a byte array to this stream.
        Overrides:
        write in class java.io.OutputStream
        Parameters:
        buf - data to be written
        off - index of first byte to be written
        len - number of bytes to write
        Throws:
        java.io.IOException - if an error occurs writing to the stream
        java.lang.NullPointerException - if buf is null
        java.lang.IndexOutOfBoundsException - if off < 0, len < 0 or off + len > buf.length
      • write

        public void write​(byte[] buf)
                   throws java.io.IOException
        Write the contents of the byte array to the buffer. Same as calling write(buf,0,len).
        Overrides:
        write in class java.io.OutputStream
        Parameters:
        buf - byte array to write to stream
        Throws:
        java.io.IOException - if an error occurs
      • close

        public void close()
                   throws java.io.IOException
        Closes this stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException - if an error occurs