Java ByteBuffer Set from(ByteBuffer buffer, int offset)

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

Description

from

License

BSD License

Declaration

public static ByteBuffer from(ByteBuffer buffer, int offset) 

Method Source Code

//package com.java2s;
/**/*from  ww w  .j  a va  2s  . co  m*/
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 * 
 * @author The JCodec project
 * 
 */

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer from(ByteBuffer buffer, int offset) {
        ByteBuffer dup = buffer.duplicate();
        dup.position(dup.position() + offset);
        return dup;
    }

    public static ByteBuffer duplicate(ByteBuffer bb) {
        ByteBuffer out = ByteBuffer.allocate(bb.remaining());
        out.put(bb.duplicate());
        out.flip();
        return out;
    }
}

Related

  1. charSequence2ByteBuffer(CharSequence cs, Charset charset)
  2. charstoUTF8Bytes(char[] srcBuf, int srcOffset, int srcLength, ByteBuffer dest, int destOffset)
  3. equals(final ByteBuffer keyValue, final int offset, final int keyLen, final byte[] otherKey)
  4. find(ByteBuffer buffer, int offset, byte searchKey)
  5. findCommonPrefix(ByteBuffer buffer, int offsetLeft, int offsetRight, int limit)
  6. fromListToSetByteArray(List list)
  7. get(ByteBuffer srcBuffer, byte[] dstBytes, int dstOffset, int length)
  8. getCharsetFromDocument(ByteBuffer bb)
  9. getEquals(ByteBuffer buf, String s, String charsetName)