Package okio
Class Utf8
- java.lang.Object
-
- okio.Utf8
-
public final class Utf8 extends java.lang.Object
Okio assumes most applications use UTF-8 exclusively, and offers optimized implementations of common operations on UTF-8 strings.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
, orEOF
BufferedSource.readUtf8Line()
Measure the bytes in a UTF-8 string size(java.lang.String)
,size(String, int, int)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
size(java.lang.String string)
Returns the number of bytes used to encodestring
as UTF-8 when usingByteString.encodeUtf8(java.lang.String)
orBuffer.writeUtf8(String)
.static long
size(java.lang.String string, int beginIndex, int endIndex)
Returns the number of bytes used to encode the slice ofstring
as UTF-8 when usingBufferedSink.writeUtf8(String, int, int)
.
-
-
-
Method Detail
-
size
public static long size(java.lang.String string)
Returns the number of bytes used to encodestring
as UTF-8 when usingByteString.encodeUtf8(java.lang.String)
orBuffer.writeUtf8(String)
.
-
size
public static long size(java.lang.String string, int beginIndex, int endIndex)
Returns the number of bytes used to encode the slice ofstring
as UTF-8 when usingBufferedSink.writeUtf8(String, int, int)
.
-
-