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