Package org.apache.uima.util.impl
Class DataIO
java.lang.Object
org.apache.uima.util.impl.DataIO
Methods for working with Data during I/O
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
decodeUTF8
(ByteBuffer in, int length) static long
lengthUTFv
(String string) static int
lengthVnumber
(int v) static int
lengthVnumber
(long v) static int
lengthVPNnumber
(int v) static int
lengthVPNnumber
(long v) static byte[]
static int[]
static int[]
static long[]
static long[]
static long
readRestOfVlong
(DataInput in, int firstByte) static int
static String
static long
static int
readVnumber
(DataInput in) static void
writeByte
(DataOutput out, int v) DataOutputStream writeByte with checking of argumentstatic void
writeByteArray
(DataOutput out, byte[] v) static void
writeIntArray
(DataOutput out, int[] v) write array preceded by its lengthstatic void
writeIntArrayDelta
(DataOutput out, int[] v) Write delta encoded value, for increasing valuesstatic void
writeLongArray
(DataOutput out, long[] v) static void
writeLongArrayDelta
(DataOutput out, long[] v) static void
writeShort
(DataOutput out, int v) DataOutputStream writeShort with checking of argumentstatic void
writeUnsignedByte
(DataOutput out, int v) Write lower 8 bitsstatic void
writeUTFv
(String string, DataOutput out) Similar to writeUTF, but ok for strings > 32K bytes long and better for strings < 127 string utf-8 length must be ≤ Integer.MAX_VALUE - 1static void
writeVnumber
(DataOutput out, int v) Write a positive number with the fewest bytes possible up to 127 written as a byte high order bit on means get another byte Note: value treated as unsigned 32 bit intstatic void
writeVnumber
(DataOutput out, long v) Write a positive long with the fewest bytes possible; up to 127 written as a byte, high order bit on means get another byte.static void
writeVPNnumber
(DataOutput out, int v) write a positive or negative number, optimized for fewer bytes near 0 sign put in low order bit, rest of number converted to positive and shifted left 1 max negative written as - 0.static void
writeVPNnumber
(DataOutput out, long v)
-
Field Details
-
UTF8
-
-
Constructor Details
-
DataIO
public DataIO()
-
-
Method Details
-
decodeUTF8
-
writeUTFv
Similar to writeUTF, but ok for strings > 32K bytes long and better for strings < 127 string utf-8 length must be ≤ Integer.MAX_VALUE - 1- Parameters:
string
- the string to writeout
- the output sink- Throws:
IOException
- passthru
-
readUTFv
- Throws:
IOException
-
lengthUTFv
- Throws:
UnsupportedEncodingException
-
writeShort
DataOutputStream writeShort with checking of argument- Parameters:
out
- the output sinkv
- the value to write- Throws:
IOException
- passthru
-
writeByte
DataOutputStream writeByte with checking of argument- Parameters:
out
- output sinkv
- the value to write- Throws:
IOException
- passthru
-
writeUnsignedByte
Write lower 8 bits- Parameters:
out
- output sinkv
- the value to write- Throws:
IOException
- passthru
-
writeVPNnumber
write a positive or negative number, optimized for fewer bytes near 0 sign put in low order bit, rest of number converted to positive and shifted left 1 max negative written as - 0.- Parameters:
out
- output sinkv
- the value to write- Throws:
IOException
- passthru
-
writeVPNnumber
- Throws:
IOException
-
lengthVPNnumber
public static int lengthVPNnumber(int v) -
lengthVPNnumber
public static int lengthVPNnumber(long v) -
writeVnumber
Write a positive number with the fewest bytes possible up to 127 written as a byte high order bit on means get another byte Note: value treated as unsigned 32 bit int- Parameters:
out
- output sinkv
- the value to write- Throws:
IOException
- passthru
-
lengthVnumber
public static int lengthVnumber(int v) -
readVnumber
- Throws:
IOException
-
writeVnumber
Write a positive long with the fewest bytes possible; up to 127 written as a byte, high order bit on means get another byte.- Parameters:
out
- output sinkv
- the value to write is never negative- Throws:
IOException
- passthru
-
lengthVnumber
public static int lengthVnumber(long v) -
readVlong
- Throws:
IOException
-
readRestOfVlong
- Throws:
IOException
-
writeByteArray
- Throws:
IOException
-
readByteArray
- Throws:
IOException
-
writeIntArray
write array preceded by its length- Parameters:
out
- output sinkv
- the value to write- Throws:
IOException
- passthru
-
readIntArray
- Throws:
IOException
-
writeIntArrayDelta
Write delta encoded value, for increasing values- Parameters:
out
- output sinkv
- the value to write- Throws:
IOException
- passthru
-
readIntArrayDelta
- Throws:
IOException
-
writeLongArray
- Throws:
IOException
-
readLongArray
- Throws:
IOException
-
writeLongArrayDelta
- Throws:
IOException
-
readLongArrayDelta
- Throws:
IOException
-
readUnsignedByte
- Throws:
IOException
-