Java ByteBuffer Put extractString(ByteArrayOutputStream byteBuffer)

Here you can find the source of extractString(ByteArrayOutputStream byteBuffer)

Description

extract String

License

Apache License

Declaration

static String extractString(ByteArrayOutputStream byteBuffer) 

Method Source Code


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

import java.io.ByteArrayOutputStream;

import java.nio.charset.Charset;

public class Main {
    public static final Charset CHARSET = Charset.forName("UTF-8");

    static String extractString(ByteArrayOutputStream byteBuffer) {
        String string = new String(byteBuffer.toByteArray(), CHARSET);
        byteBuffer.reset();/*  w w w.  j  av  a  2  s .c  om*/
        return string;
    }
}

Related

  1. byteBufferToOutputStream(ByteBuffer in, OutputStream out)
  2. checkReadSpace(FileInputStream aStream, ByteBuffer aBuf)
  3. computeSize(ByteBuffer[] buffers)
  4. convert(Object lock, CharsetEncoder encoder, ByteBuffer bytes, CharBuffer chars, OutputStream out)
  5. deserializeString(ByteBuffer inputBuffer, Charset charset)
  6. flushOutputStreamWriter(OutputStream out, ByteBuffer bytes, CharsetEncoder encoder, Object lock)
  7. getZeroTerminatedStringBytesArray( ByteBuffer inputBuffer)
  8. inputStream(ByteBuffer bytes)
  9. inputStreamToByteBuffer(InputStream input)