Documentation of 'org.freehep.util.io.ByteOrderOutputStream' Java class
ByteOrderOutputStream
org.freehep.util.io

Class ByteOrderOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.lang.AutoCloseable, FinishableOutputStream
    Direct Known Subclasses:
    ByteCountOutputStream


    public class ByteOrderOutputStream
    extends BitOutputStream
    implements java.io.DataOutput
    Class to write bytes and pairs of bytes in both little and big endian order.
    • Constructor Detail

      • ByteOrderOutputStream

        public ByteOrderOutputStream(java.io.OutputStream out)
        Create a (Big Endian) Byte Order output stream from given stream
        Parameters:
        out - stream to write to
      • ByteOrderOutputStream

        public ByteOrderOutputStream(java.io.OutputStream out,
                                     boolean littleEndian)
        Create a Byte Order output stream from the given stream
        Parameters:
        out - stream to write to
        littleEndian - true if stream should be little endian
    • Method Detail

      • size

        public int size()
                 throws java.io.IOException
        Returns:
        number of written bytes
        Throws:
        java.io.IOException - if write fails FIXME, should this throw an exception ?
      • write

        public void write(int b)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class BitOutputStream
        Throws:
        java.io.IOException
      • writeBoolean

        public void writeBoolean(boolean b)
                          throws java.io.IOException
        Specified by:
        writeBoolean in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeChar

        public void writeChar(int c)
                       throws java.io.IOException
        Specified by:
        writeChar in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeByte

        public void writeByte(int b)
                       throws java.io.IOException
        Write a signed byte.
        Specified by:
        writeByte in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeByte

        public void writeByte(byte[] bytes)
                       throws java.io.IOException
        Writes array of bytes
        Parameters:
        bytes - byte array to be written
        Throws:
        java.io.IOException - if write fails
      • writeUnsignedByte

        public void writeUnsignedByte(int ub)
                               throws java.io.IOException
        Write an unsigned byte.
        Parameters:
        ub - byte to write
        Throws:
        java.io.IOException - if write fails
      • writeUnsignedByte

        public void writeUnsignedByte(int[] bytes)
                               throws java.io.IOException
        Write an array of unsigned bytes.
        Parameters:
        bytes - int array to write as bytes
        Throws:
        java.io.IOException - if write fails
      • writeShort

        public void writeShort(int s)
                        throws java.io.IOException
        Write a signed short.
        Specified by:
        writeShort in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeShort

        public void writeShort(short[] shorts)
                        throws java.io.IOException
        Write an array of shorts.
        Parameters:
        shorts - short array to write
        Throws:
        java.io.IOException - if write fails
      • writeUnsignedShort

        public void writeUnsignedShort(int s)
                                throws java.io.IOException
        Write an unsigned short.
        Parameters:
        s - int to write as unsigned short
        Throws:
        java.io.IOException - if write fails
      • writeUnsignedShort

        public void writeUnsignedShort(int[] shorts)
                                throws java.io.IOException
        Write an array of unsigned shorts.
        Parameters:
        shorts - int array to write as unsigned shorts
        Throws:
        java.io.IOException - if write fails
      • writeInt

        public void writeInt(int i)
                      throws java.io.IOException
        Write a signed integer.
        Specified by:
        writeInt in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeInt

        public void writeInt(int[] ints)
                      throws java.io.IOException
        Write an array of ints
        Parameters:
        ints - int array to write
        Throws:
        java.io.IOException - if write fails
      • writeUnsignedInt

        public void writeUnsignedInt(long i)
                              throws java.io.IOException
        Write an unsigned integer.
        Parameters:
        i - long to write as unsigned int
        Throws:
        java.io.IOException - if write fails
      • writeUnsignedInt

        public void writeUnsignedInt(long[] ints)
                              throws java.io.IOException
        Write an array of unsigned ints
        Parameters:
        ints - long array to write as unsigned ints
        Throws:
        java.io.IOException - if write fails
      • writeLong

        public void writeLong(long l)
                       throws java.io.IOException
        Specified by:
        writeLong in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeFloat

        public void writeFloat(float f)
                        throws java.io.IOException
        Specified by:
        writeFloat in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeDouble

        public void writeDouble(double d)
                         throws java.io.IOException
        Specified by:
        writeDouble in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeBytes

        public void writeBytes(java.lang.String s)
                        throws java.io.IOException
        Specified by:
        writeBytes in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeChars

        public void writeChars(java.lang.String s)
                        throws java.io.IOException
        Specified by:
        writeChars in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeString

        public void writeString(java.lang.String s)
                         throws java.io.IOException
        Write a string (UTF)
        Parameters:
        s - string to write
        Throws:
        java.io.IOException - if write fails
      • writeUTF

        public void writeUTF(java.lang.String s)
                      throws java.io.IOException
        Specified by:
        writeUTF in interface java.io.DataOutput
        Throws:
        java.io.IOException
      • writeAsciiZString

        public void writeAsciiZString(java.lang.String s)
                               throws java.io.IOException
        Write an ascii-z (0 terminated c-string).
        Parameters:
        s - string to write
        Throws:
        java.io.IOException - if write fails
      • writeUTF

        public static void writeUTF(java.lang.String s,
                                    java.io.DataOutput dos)
                             throws java.io.IOException
        Write a UTF string to the data output stream. This method should have been in DataOutputStream, but is not visible.
        Parameters:
        s - string to write
        dos - stream to write to
        Throws:
        java.io.IOException - if write fails

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.