Java ByteBuffer Set parseContent(ByteBuffer buffer, int offset, int length)

Here you can find the source of parseContent(ByteBuffer buffer, int offset, int length)

Description

parse Content

License

Apache License

Declaration

public static String parseContent(ByteBuffer buffer, int offset, int length) throws IOException 

Method Source Code


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

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

public class Main {
    public static String parseContent(ByteBuffer buffer, int offset, int length) throws IOException {
        //        InputStream inputStream = new ByteBufferBackedInputStream(buffer);
        //        InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "ISO-8859-1");
        //        BufferedReader bufferedReader = null;
        byte[] chunk = new byte[length];
        char[] start = new char[length];
        try {/*  w w  w  .  j  a va 2 s . c o m*/
            //            bufferedReader = new BufferedReader(inputStreamReader);
            //            bufferedReader.read(start, offset, length);
            buffer.get(chunk, offset, length);
            return new String(chunk, StandardCharsets.ISO_8859_1);
            //            return String.valueOf(start);
        } finally {
            buffer.rewind();
            //            bufferedReader.close();
        }
    }
}

Related

  1. getSignedInt(ByteBuffer buffer, int offset)
  2. hash_murmur3_128(ByteBuffer buf, int offset, int size, int i, byte[] result)
  3. isFree(int frameIx, int offset, ByteBuffer[] frames)
  4. macAddressToString(ByteBuffer packet, int offset, boolean needHyphen)
  5. memset(ByteBuffer dstBuffer, int dstByteOffset, byte value, int length)
  6. parseToByteBuffer(Object value)
  7. pourBufferToArray(ByteBuffer source, byte[] destination, int offset, int sizeRequested)
  8. readBitset(ByteBuffer bb, int numbytes)
  9. readBitSet(ByteBuffer buf, int len)