Class ReplicationOutputStream

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

    public class ReplicationOutputStream
    extends java.io.ByteArrayOutputStream
    Author:
    Mahesh Kannan
    • Field Summary

      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void backToAppendMode()
      Note: This must be used only after a call to moveTo
      int mark()  
      int moveTo​(int pos)  
      void reWrite​(int mark, byte[] data)  
      byte[] toByteArray()  
      void writeBoolean​(boolean b)  
      void writeInt​(int value)  
      void writeLengthPrefixedBytes​(byte[] data)  
      void writeLengthPrefixedString​(java.lang.String str)  
      void writeLong​(long value)  
      • Methods inherited from class java.io.ByteArrayOutputStream

        close, reset, size, toString, toString, toString, toString, write, write, writeBytes, writeTo
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

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

      • ReplicationOutputStream

        public ReplicationOutputStream()
    • Method Detail

      • mark

        public int mark()
      • reWrite

        public void reWrite​(int mark,
                            byte[] data)
      • writeInt

        public void writeInt​(int value)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLong

        public void writeLong​(long value)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLengthPrefixedString

        public void writeLengthPrefixedString​(java.lang.String str)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLengthPrefixedBytes

        public void writeLengthPrefixedBytes​(byte[] data)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBoolean

        public void writeBoolean​(boolean b)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • moveTo

        public int moveTo​(int pos)
      • backToAppendMode

        public void backToAppendMode()
        Note: This must be used only after a call to moveTo
      • toByteArray

        public byte[] toByteArray()
        Overrides:
        toByteArray in class java.io.ByteArrayOutputStream