Here you can find the source of setCell(ByteBuffer buffer, int cellIndex, int cellbytes)
Parameter | Description |
---|---|
cellIndex | zero based cell index (starts at the beginning of the <tt>buffer</tt>) |
cellbytes | number of bytes in each buffer |
public static ByteBuffer setCell(ByteBuffer buffer, int cellIndex, int cellbytes)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**/*from ww w . j ava2 s. co m*/ * Positions the given <tt>buffer</tt> at the start of the specified cell. Arguments * are not checked. * <pre><tt> * int position = cellIndex * cellbytes; * int limit = position + cellbytes; * buffer.limit(limit).position(position); * </tt></pre> * * * @param cellIndex * zero based cell index (starts at the beginning of the <tt>buffer</tt>) * @param cellbytes * number of bytes in each buffer * @return * <tt>buffer</tt> */ public static ByteBuffer setCell(ByteBuffer buffer, int cellIndex, int cellbytes) { int position = cellIndex * cellbytes; int limit = position + cellbytes; buffer.limit(limit).position(position); return buffer; } }