public final class Utf8 extends Object
ByteString |
Buffer , BufferedSink , BufferedSource |
|
---|---|---|
Encode a string | ByteString.encodeUtf8(String) |
BufferedSink.writeUtf8(String) |
Encode a code point | BufferedSink.writeUtf8CodePoint(int) |
|
Decode a string | ByteString.utf8() |
BufferedSource.readUtf8() , BufferedSource.readUtf8(long) |
Decode a code point | BufferedSource.readUtf8CodePoint() |
|
Decode until the next \r\n or \n |
BufferedSource.readUtf8LineStrict() ,
BufferedSource.readUtf8LineStrict(long) |
|
Decode until the next \r\n , \n , or EOF |
BufferedSource.readUtf8Line() |
|
Measure the bytes in a UTF-8 string | size(java.lang.String) , size(String, int, int) |
Modifier and Type | Method and Description |
---|---|
static long |
size(String string)
Returns the number of bytes used to encode
string as UTF-8 when using ByteString.encodeUtf8(java.lang.String) or Buffer.writeUtf8(String) . |
static long |
size(String string,
int beginIndex,
int endIndex)
Returns the number of bytes used to encode the slice of
string as UTF-8 when using
BufferedSink.writeUtf8(String, int, int) . |
public static long size(String string)
string
as UTF-8 when using ByteString.encodeUtf8(java.lang.String)
or Buffer.writeUtf8(String)
.public static long size(String string, int beginIndex, int endIndex)
string
as UTF-8 when using
BufferedSink.writeUtf8(String, int, int)
.Copyright © 2017. All rights reserved.