Java ByteBuffer Get getNTString(ByteBuffer buffer)

Here you can find the source of getNTString(ByteBuffer buffer)

Description

Parses next null-terminated string.

License

Open Source License

Declaration

public static String getNTString(ByteBuffer buffer) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    /**/* w  w w.j  av a  2s  .  c  o  m*/
     * Parses next null-terminated string.
     */
    public static String getNTString(ByteBuffer buffer) {
        StringBuilder result = new StringBuilder();
        while (buffer.remaining() > 0) {
            char c = (char) buffer.get();
            if (c == '\0')
                break;
            result.append(c);
        }

        return result.toString();
    }
}

Related

  1. getMediumInt(ByteBuffer buffer)
  2. getModularShort(ByteBuffer bb)
  3. getMultiString(ByteBuffer bb, boolean wideChar)
  4. getNaluStartLength(ByteBuffer buffer)
  5. getNextTagNum(ByteBuffer message)
  6. getNullTerminatedByte(ByteBuffer buffer)
  7. getNumeric(java.nio.ByteBuffer buffer, int len)
  8. getObject(ByteBuffer buffer)
  9. getObject(ByteBuffer byteBuffer)