Class LongUTFDataOutputStream

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

    public class LongUTFDataOutputStream
    extends java.io.DataOutputStream
    This class works around the size limitation of UTF strings (< 64kb) of DataOutputStream and needs to be used with LongUTFDataInputStream
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int countUTF​(java.lang.String str)  
      void writeLongUTF​(java.lang.String str)
      Checks the length of the to-be-written UTF-8 array, if the length is below 64k then DataOutputStream.writeUTF(String) is called, otherwise a 4-byte (int) is injected to list/count the appended UTF-8 bytes
      void writeShortOrInt​(int value)  
      static void writeShortOrInt​(java.io.DataOutputStream dos, int value)  
      • 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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.io.DataOutput

        write
    • Constructor Detail

      • LongUTFDataOutputStream

        public LongUTFDataOutputStream​(java.io.OutputStream out)
    • Method Detail

      • writeShortOrInt

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

        public static void writeShortOrInt​(java.io.DataOutputStream dos,
                                           int value)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLongUTF

        public void writeLongUTF​(java.lang.String str)
                          throws java.io.IOException
        Checks the length of the to-be-written UTF-8 array, if the length is below 64k then DataOutputStream.writeUTF(String) is called, otherwise a 4-byte (int) is injected to list/count the appended UTF-8 bytes
        Parameters:
        str - the string to be written as UTF8-modified
        Throws:
        java.io.IOException
      • countUTF

        public static int countUTF​(java.lang.String str)