Java ByteBuffer Dump dump(ByteBuffer buffer, int pos, int limit)

Here you can find the source of dump(ByteBuffer buffer, int pos, int limit)

Description

dump

License

Open Source License

Declaration

public static String dump(ByteBuffer buffer, int pos, int limit) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    public static String dump(ByteBuffer buffer, int pos, int limit) {
        int oldpos = buffer.position();
        int oldlimit = buffer.limit();
        buffer.limit(limit).position(pos);

        StringBuilder builder = new StringBuilder("[");
        for (int idx = buffer.position(); idx < buffer.limit(); ++idx) {
            builder.append(buffer.get(idx));
            builder.append(',');
        }/*from  w ww .j  a v a  2  s .  c o  m*/
        builder.append(']');

        buffer.limit(oldlimit).position(oldpos);
        return builder.toString();
    }
}

Related

  1. bbdump(ByteBuffer sbb)
  2. dump(ByteBuffer bb)
  3. dump(ByteBuffer buff, int size, boolean asBits)
  4. dump(ByteBuffer buffer)
  5. dump(ByteBuffer buffer)
  6. dump(ByteBuffer buffer, OutputStream stream)
  7. dumpAsHex(byte[] byteBuffer, int length)
  8. dumpBoolean(ByteBuffer itemBuffer, StringBuilder sb, String tag)
  9. dumpBytes(ByteBuffer bbuf)