mirror of https://github.com/apache/druid.git
Add javadocs to StringUtils.fromUtf8. (#11881)
They clarify that the methods advance the position of the buffer.
This commit is contained in:
parent
8971056763
commit
1c12dd97dc
|
@ -88,6 +88,10 @@ public class StringUtils
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a UTF-8 String from {@code numBytes} bytes starting at the current position of a buffer.
|
||||
* Advances the position of the buffer by {@code numBytes}.
|
||||
*/
|
||||
public static String fromUtf8(final ByteBuffer buffer, final int numBytes)
|
||||
{
|
||||
final byte[] bytes = new byte[numBytes];
|
||||
|
@ -95,6 +99,10 @@ public class StringUtils
|
|||
return fromUtf8(bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a UTF-8 string from the remaining bytes of a buffer.
|
||||
* Advances the position of the buffer by {@link ByteBuffer#remaining()}.
|
||||
*/
|
||||
public static String fromUtf8(final ByteBuffer buffer)
|
||||
{
|
||||
return StringUtils.fromUtf8(buffer, buffer.remaining());
|
||||
|
|
Loading…
Reference in New Issue