Class DataWriterBigEndian

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      DataWriterBigEndian() Creates a new data array output stream.
      DataWriterBigEndian(int capacity) Creates a new data array output stream, with a buffer capacity of the specified size, in bytes.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      synchronized void reset() Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the output stream is discarded.
      void storePosition() Save current position.
      void restorePosition()
      void moveTo(int index)
      synchronized void write(int b) Writes the specified byte to this byte array output stream.
      synchronized void write(Array<byte> b)
      synchronized void write(Array<byte> b, int off, int len) Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
      final void writeByte(byte b) Write single byte to stream.
      final void writeBoolean(boolean v) Writes a boolean to the underlying output stream as a 1-byte value.
      final void writeShort(int v) Writes a short to the underlying output stream as two bytes, high byte first.
      final void writeInt(int v) Writes an int to the underlying output stream as four bytes, high byte first.
      final void writeLong(long v) Writes a long to the underlying output stream as eight bytes, high byte first.
      final void writeFloat(float v) Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream as a 4-byte quantity, high byte first.
      final void writeDouble(double v) Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first.
      final void writeString(String string)
      final void writeStringDos(String string)
      final void writeStorable(Storable obj)
      void writeListString(List<String> objs)
      void writeListStorable(List<out Storable> objs)
      synchronized void writeTo(OutputStream out) Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).
      synchronized Array<byte> toByteArray() Creates a newly allocated byte array.
      synchronized int size() Returns the current size of the buffer.
      • Methods inherited from class java.lang.Object

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

      • DataWriterBigEndian

        DataWriterBigEndian()
        Creates a new data array output stream.
      • DataWriterBigEndian

        DataWriterBigEndian(int capacity)
        Creates a new data array output stream, with a buffer capacity of the specified size, in bytes.
        Parameters:
        capacity - the initial size.
    • Method Detail

      • reset

         synchronized void reset()

        Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the output stream is discarded. The output stream can be used again, reusing the already allocated buffer space.

      • moveTo

         void moveTo(int index)
      • write

         synchronized void write(int b)

        Writes the specified byte to this byte array output stream.

        Parameters:
        b - the byte to be written.
      • write

         synchronized void write(Array<byte> b, int off, int len)

        Writes len bytes from the specified byte array starting at offset off to this byte array output stream.

        Parameters:
        b - the data.
        off - the start offset in the data.
        len - the number of bytes to write.
      • writeByte

         final void writeByte(byte b)

        Write single byte to stream.

      • writeBoolean

         final void writeBoolean(boolean v)

        Writes a boolean to the underlying output stream as a 1-byte value. The value true is written out as the value (byte)1; the value false is written out as the value (byte)0. If no exception is thrown, the counter written is incremented by 1.

        Parameters:
        v - a boolean value to be written.
      • writeShort

         final void writeShort(int v)

        Writes a short to the underlying output stream as two bytes, high byte first. If no exception is thrown, the counter written is incremented by 2.

        Parameters:
        v - a short to be written.
      • writeInt

         final void writeInt(int v)

        Writes an int to the underlying output stream as four bytes, high byte first. If no exception is thrown, the counter written is incremented by 4.

        Parameters:
        v - an int to be written.
      • writeLong

         final void writeLong(long v)

        Writes a long to the underlying output stream as eight bytes, high byte first. In no exception is thrown, the counter written is incremented by 8.

        Parameters:
        v - a long to be written.
      • writeFloat

         final void writeFloat(float v)

        Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream as a 4-byte quantity, high byte first. If no exception is thrown, the counter written is incremented by 4.

        Parameters:
        v - a float value to be written.
      • writeDouble

         final void writeDouble(double v)

        Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first. If no exception is thrown, the counter written is incremented by 8.

        Parameters:
        v - a double value to be written.
      • writeTo

         synchronized void writeTo(OutputStream out)

        Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).

        Parameters:
        out - the output stream to which to write the data.
      • toByteArray

         synchronized Array<byte> toByteArray()

        Creates a newly allocated byte array. Its size is the current size of this output stream and the valid contents of the buffer have been copied into it.

      • size

         synchronized int size()

        Returns the current size of the buffer.