List of utility methods to do ByteBuffer Put
void | putString(@Nullable final String s, @Nonnull final ByteBuffer dst) put String if (s == null) { dst.putInt(-1); return; final char[] array = s.toCharArray(); final int size = array.length; dst.putInt(size); for (int i = 0; i < size; i++) { ... |
void | putString(ByteBuffer bb, String s) put String byte[] b = s.getBytes(Charset.forName("UTF-8")); bb.putShort((short) b.length); bb.put(b); |
void | putString(ByteBuffer buf, String value) put String if (value == null) { buf.putShort((short) -1); } else { buf.putShort((short) value.length()); for (int i = 0; i < value.length(); i++) { buf.putChar(value.charAt(i)); |
void | putString(ByteBuffer buffer, String s) Relative put operation. Write a String in a ByteBuffer object.In some case, you also need to put a NULL terminal character at the end of the string. buffer.put(s.getBytes()); |
void | putString(ByteBuffer buffer, String s) Relative put operation. Write a String in a ByteBuffer object.In some case, you also need to put a NULL terminal character at the end of the string. buffer.put(s.getBytes()); |
void | putString(final ByteBuffer buffer, final String string) Writes the given String to the ByteBuffer. buffer.putInt(string.length()); for (int i = 0; i < string.length(); i++) { buffer.putChar(string.charAt(i)); |
void | putString(String name, ByteBuffer buffer) put String buffer.put(name.getBytes()).put((byte) 0);
|
ByteBuffer | putString(String str, ByteBuffer bb) put String if (str == null) { throw new NullPointerException("Argument str cannot be null"); if (bb == null) { throw new NullPointerException("Argument bb cannot be null"); if (str.length() > 255) { throw new IllegalArgumentException("Cannot store string: length greater than 255 characters."); ... |
void | putStringAsCharArray(ByteBuffer byteBuffer, String s) put String As Char Array byteBuffer.asCharBuffer().put(s); byteBuffer.position(byteBuffer.position() + (s.length() * 2)); |
void | putStringToByteBuffer(final ByteBuffer bb, String value, String charset) put String To Byte Buffer if (value != null) { try { bb.put(value.getBytes(charset)); } catch (UnsupportedEncodingException e) { bb.put(value.getBytes()); |