Class ByteArrayDataOutputStream

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

    public class ByteArrayDataOutputStream
    extends java.io.DataOutputStream
    DataOutputStream sub class that allows for the lazy writing of length values.

    These length values are inserted into the bytes when then final bytes are read.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.ByteArrayOutputStream bytes  
      private java.util.List<ByteArrayDataOutputStream.LazySizeImpl> sizes  
      • Fields inherited from class java.io.DataOutputStream

        written
      • Fields inherited from class java.io.FilterOutputStream

        out
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBytes()  
      private void overwriteInt​(byte[] bytecode, int offset, int value)
      overwrites a 32 bit value in the already written bytecode data
      LazySize writeSize()  
      • Methods inherited from class java.io.DataOutputStream

        flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
      • Methods inherited from class java.io.FilterOutputStream

        close, write
      • 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
      • Methods inherited from interface java.io.DataOutput

        write
    • Constructor Detail

      • ByteArrayDataOutputStream

        public ByteArrayDataOutputStream​(java.io.ByteArrayOutputStream bytes)
      • ByteArrayDataOutputStream

        public ByteArrayDataOutputStream()
    • Method Detail

      • writeSize

        public LazySize writeSize()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getBytes

        public byte[] getBytes()
      • overwriteInt

        private void overwriteInt​(byte[] bytecode,
                                  int offset,
                                  int value)
        overwrites a 32 bit value in the already written bytecode data