This commit is contained in:
@@ -86,6 +86,15 @@ public final class Utility {
|
|||||||
return String.format(format, System.currentTimeMillis());
|
return String.format(format, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String toString(String string, ByteBuffer buffer) {
|
||||||
|
if (buffer == null || !buffer.hasRemaining()) return string;
|
||||||
|
byte[] bytes = new byte[buffer.remaining()];
|
||||||
|
buffer.get(bytes);
|
||||||
|
buffer.flip();
|
||||||
|
if (string == null) return new String(bytes, UTF_8);
|
||||||
|
return string + new String(bytes, UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
public static void println(String string, ByteBuffer buffer) {
|
public static void println(String string, ByteBuffer buffer) {
|
||||||
if (buffer == null || !buffer.hasRemaining()) return;
|
if (buffer == null || !buffer.hasRemaining()) return;
|
||||||
byte[] bytes = new byte[buffer.remaining()];
|
byte[] bytes = new byte[buffer.remaining()];
|
||||||
|
|||||||
Reference in New Issue
Block a user