Package 

Class DataWriterBigEndian

    • 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 ofthe specified size, in bytes.
    • Method Summary

      Modifier and Type Method Description
      synchronized void reset() Resets the count field of this byte array outputstream to zero, so that all currently accumulated output in theoutput 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 arraystarting 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 asa 1-byte value.
      final void writeShort(int v) Writes a short to the underlying output stream as twobytes, high byte first.
      final void writeInt(int v) Writes an int to the underlying output stream as fourbytes, high byte first.
      final void writeLong(long v) Writes a long to the underlying output stream as eightbytes, high byte first.
      final void writeFloat(float v) Converts the float argument to an int using thefloatToIntBits method in class Float,and then writes that int value to the underlyingoutput stream as a 4-byte quantity, high byte first.
      final void writeDouble(double v) Converts the double argument to a long using thedoubleToLongBits method in class Double,and then writes that long value to the underlyingoutput 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 tothe specified output stream argument, as if by calling the outputstream'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 ofthe specified size, in bytes.
        Parameters:
        capacity - the initial size.
    • Method Detail

      • reset

         synchronized void reset()

        Resets the count field of this byte array outputstream to zero, so that all currently accumulated output in theoutput 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 arraystarting 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 asa 1-byte value. The value true is written out as thevalue (byte)1; the value false iswritten out as the value (byte)0. If no exception isthrown, the counter written is incremented by1.

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

         final void writeShort(int v)

        Writes a short to the underlying output stream as twobytes, high byte first. If no exception is thrown, the counterwritten 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 fourbytes, high byte first. If no exception is thrown, the counterwritten 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 eightbytes, high byte first. In no exception is thrown, the counterwritten 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 thefloatToIntBits method in class Float,and then writes that int value to the underlyingoutput stream as a 4-byte quantity, high byte first. If noexception is thrown, the counter written isincremented by 4.

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

         final void writeDouble(double v)

        Converts the double argument to a long using thedoubleToLongBits method in class Double,and then writes that long value to the underlyingoutput stream as an 8-byte quantity, high byte first. If noexception is thrown, the counter written isincremented 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 tothe specified output stream argument, as if by calling the outputstream'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 currentsize of this output stream and the valid contents of the bufferhave been copied into it.

      • size

         synchronized int size()

        Returns the current size of the buffer.