Package org.apache.xmlbeans.impl.util
Class LongUTFDataOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.DataOutputStream
-
- org.apache.xmlbeans.impl.util.LongUTFDataOutputStream
-
- All Implemented Interfaces:
Closeable
,DataOutput
,Flushable
,AutoCloseable
public class LongUTFDataOutputStream extends DataOutputStream
This class works around the size limitation of UTF strings (< 64kb) of DataOutputStream and needs to be used with LongUTFDataInputStream
-
-
Field Summary
-
Fields inherited from class java.io.DataOutputStream
written
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description LongUTFDataOutputStream(OutputStream out)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
countUTF(String str)
void
writeLongUTF(String str)
Checks the length of the to-be-written UTF-8 array, if the length is below 64k thenDataOutputStream.writeUTF(String)
is called, otherwise a 4-byte (int) is injected to list/count the appended UTF-8 bytesvoid
writeShortOrInt(int value)
static void
writeShortOrInt(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.io.DataOutput
write
-
-
-
-
Constructor Detail
-
LongUTFDataOutputStream
public LongUTFDataOutputStream(OutputStream out)
-
-
Method Detail
-
writeShortOrInt
public void writeShortOrInt(int value) throws IOException
- Throws:
IOException
-
writeShortOrInt
public static void writeShortOrInt(DataOutputStream dos, int value) throws IOException
- Throws:
IOException
-
writeLongUTF
public void writeLongUTF(String str) throws IOException
Checks the length of the to-be-written UTF-8 array, if the length is below 64k thenDataOutputStream.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:
IOException
-
countUTF
public static int countUTF(String str)
-
-