Java ByteBuffer Put putString(ByteBuffer bb, String s)

Here you can find the source of putString(ByteBuffer bb, String s)

Description

put String

License

LGPL

Declaration

public static void putString(ByteBuffer bb, String s) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;
import java.nio.charset.Charset;

public class Main {
    public static void putString(ByteBuffer bb, String s) {
        byte[] b = s.getBytes(Charset.forName("UTF-8"));
        bb.putShort((short) b.length);
        bb.put(b);//  w ww  .j  a v a  2s.  co m
    }
}

Related

  1. putQuickchatParam(ByteBuffer buf, long param, int size)
  2. putRange(ByteBuffer buffer, int start, int end, byte b)
  3. putRGBfromHSB(final ByteBuffer pixels, final float[] hsb, int pixelSize)
  4. putStr(ByteBuffer buff, String str)
  5. putString(@Nullable final String s, @Nonnull final ByteBuffer dst)
  6. putString(ByteBuffer buf, String value)
  7. putString(ByteBuffer buffer, String s)
  8. putString(ByteBuffer buffer, String s)
  9. putString(final ByteBuffer buffer, final String string)