Java ByteBuffer to String toString(ByteBuffer sequence)

Here you can find the source of toString(ByteBuffer sequence)

Description

Convert a byte buffer to a string in platform default encoding.

License

Apache License

Declaration

public static String toString(ByteBuffer sequence) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    /**// w  ww  . ja va 2  s.co  m
     * Convert a byte buffer to a string in platform default encoding.
     */
    public static String toString(ByteBuffer sequence) {
        return new String(sequence.array(), sequence.position(), sequence.remaining());
    }
}

Related

  1. toString(ByteBuffer buffer, Charset charset)
  2. toString(ByteBuffer buffer, int offset, int length)
  3. toString(ByteBuffer buffer, String encoding)
  4. toString(ByteBuffer bytes)
  5. toString(ByteBuffer bytes)
  6. toString(ByteBuffer value, String charsetName)
  7. toString(final ByteBuffer buffer)
  8. toString(final ByteBuffer buffer)
  9. toString(final ByteBuffer buffer)