public final class UTFUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static long |
getLongUTFLength(java.lang.String s)
Get the number of bytes used by the modified UTF-8 encoded form of the given string.
|
static int |
getShortUTFLength(java.lang.String s)
Get the number of bytes used by the modified UTF-8 encoded form of the given string.
|
static java.lang.String |
readUTFBytes(ByteInput input,
int len)
Read the given number of characters from the given byte input.
|
static java.lang.String |
readUTFBytesByByteCount(ByteInput input,
long len)
Read the given number of characters from the given byte input.
|
static java.lang.String |
readUTFZBytes(ByteInput input)
Read a null-terminated modified UTF-8 string from the given byte input.
|
static void |
writeUTFBytes(ByteOutput output,
java.lang.String s)
Write the modified UTF-8 form of the given string to the given output.
|
public static int getShortUTFLength(java.lang.String s) throws java.io.UTFDataFormatException
65536
, an exception is thrown.s
- the stringjava.io.UTFDataFormatException
- if the string is longer than 65536
charactersDataInput.readUTF()
public static long getLongUTFLength(java.lang.String s)
s
- the stringDataInput.readUTF()
public static void writeUTFBytes(ByteOutput output, java.lang.String s) throws java.io.IOException
output
- the output to write tos
- the stringjava.io.IOException
- if an I/O error occursDataOutput.writeUTF(String)
public static java.lang.String readUTFBytes(ByteInput input, int len) throws java.io.IOException
input
- the byte sourcelen
- the number of characters to readjava.io.IOException
- if an I/O error occursDataInput.readUTF()
public static java.lang.String readUTFBytesByByteCount(ByteInput input, long len) throws java.io.IOException
input
- the byte sourcelen
- the number of bytes to readjava.io.IOException
- if an I/O error occursDataInput.readUTF()
public static java.lang.String readUTFZBytes(ByteInput input) throws java.io.IOException
input
- the inputjava.io.IOException
- if an I/O error occursDataInput.readUTF()
Copyright © 2011 JBoss, a division of Red Hat, Inc.