Class BinaryOutputStream

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

    public class BinaryOutputStream
    extends java.io.OutputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteOrder byteOrder  
      private int count  
      private java.io.OutputStream os  
    • Constructor Summary

      Constructors 
      Constructor Description
      BinaryOutputStream​(java.io.OutputStream os)  
      BinaryOutputStream​(java.io.OutputStream os, java.nio.ByteOrder byteOrder)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      int getByteCount()  
      java.nio.ByteOrder getByteOrder()  
      protected void setByteOrder​(java.nio.ByteOrder byteOrder)  
      void write​(byte[] bytes)  
      void write​(byte[] bytes, int offset, int length)  
      void write​(int i)  
      void write2Bytes​(int value)  
      void write3Bytes​(int value)  
      void write4Bytes​(int value)  
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

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

      • os

        private final java.io.OutputStream os
      • byteOrder

        private java.nio.ByteOrder byteOrder
      • count

        private int count
    • Constructor Detail

      • BinaryOutputStream

        public BinaryOutputStream​(java.io.OutputStream os,
                                  java.nio.ByteOrder byteOrder)
      • BinaryOutputStream

        public BinaryOutputStream​(java.io.OutputStream os)
    • Method Detail

      • setByteOrder

        protected void setByteOrder​(java.nio.ByteOrder byteOrder)
      • getByteOrder

        public java.nio.ByteOrder getByteOrder()
      • write

        public void write​(int i)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public final void write​(byte[] bytes)
                         throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public final void write​(byte[] bytes,
                                int offset,
                                int length)
                         throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        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
      • getByteCount

        public int getByteCount()
      • write4Bytes

        public final void write4Bytes​(int value)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • write3Bytes

        public final void write3Bytes​(int value)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • write2Bytes

        public final void write2Bytes​(int value)
                               throws java.io.IOException
        Throws:
        java.io.IOException