本文整理汇总了Java中java.nio.IntBuffer.capacity方法的典型用法代码示例。如果您正苦于以下问题:Java IntBuffer.capacity方法的具体用法?Java IntBuffer.capacity怎么用?Java IntBuffer.capacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.nio.IntBuffer
的用法示例。
在下文中一共展示了IntBuffer.capacity方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: densePlusSparse
import java.nio.IntBuffer; //导入方法依赖的package包/类
private void densePlusSparse(IntBuffer keys, IntBuffer values) {
int length = keys.capacity();
int ov, value, key;
for (int i = 0; i < length; i++) {
key = keys.get(i);
ov = denseRep.get(key);
value = ov + values.get(i);
if (ov != 0 && value == 0)
nnz--;
denseRep.put(key, value);
}
int size = (int)(endCol - startCol);
if (nnz < threshold * size)
denseToSparse();
}
示例2: readFrom
import java.nio.IntBuffer; //导入方法依赖的package包/类
static ImageHeader readFrom(IntBuffer buffer) {
Objects.requireNonNull(buffer);
if (buffer.capacity() != HEADER_SLOTS) {
throw new InternalError(
"jimage header not the correct size: " + buffer.capacity());
}
int magic = buffer.get(0);
int version = buffer.get(1);
int majorVersion = version >>> 16;
int minorVersion = version & 0xFFFF;
int flags = buffer.get(2);
int resourceCount = buffer.get(3);
int tableLength = buffer.get(4);
int locationsSize = buffer.get(5);
int stringsSize = buffer.get(6);
return new ImageHeader(magic, majorVersion, minorVersion, flags,
resourceCount, tableLength, locationsSize, stringsSize);
}
示例3: loadInMemoryStorage
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Override
public void loadInMemoryStorage( final ColumnBinary columnBinary , final IMemoryAllocator allocator ) throws IOException{
for( ColumnBinary childColumnBinary : columnBinary.columnBinaryList ){
IColumnBinaryMaker maker = FindColumnBinaryMaker.get( childColumnBinary.makerClassName );
IMemoryAllocator childMemoryAllocator = allocator.getArrayChild( childColumnBinary.rowCount , childColumnBinary.columnType );
maker.loadInMemoryStorage( childColumnBinary , childMemoryAllocator );
}
ICompressor compressor = FindCompressor.get( columnBinary.compressorClassName );
byte[] decompressBuffer = compressor.decompress( columnBinary.binary , columnBinary.binaryStart , columnBinary.binaryLength );
IntBuffer buffer = ByteBuffer.wrap( decompressBuffer ).asIntBuffer();
int length = buffer.capacity();
int currentIndex = 0;
for( int i = 0 ; i < length ; i++ ){
int arrayLength = buffer.get();
if( arrayLength == 0 ){
allocator.setNull(i);
}
else{
int start = currentIndex;
allocator.setArrayIndex( i , start , arrayLength );
currentIndex += arrayLength;
}
}
allocator.setValueCount( length );
}
示例4: ArrayCellManager
import java.nio.IntBuffer; //导入方法依赖的package包/类
public ArrayCellManager( final Spread spread , final IntBuffer buffer ){
int length = buffer.capacity();
cellArray = new ICell[length];
int currentIndex = 0;
for( int i = 0 ; i < length ; i++ ){
int arrayLength = buffer.get();
if( arrayLength != 0 ){
int start = currentIndex;
int end = start + arrayLength;
cellArray[i] = new ArrayCell( new SpreadArrayLink( spread , i , start , end ) );
currentIndex += arrayLength;
}
}
}
示例5: densePlusDense
import java.nio.IntBuffer; //导入方法依赖的package包/类
private void densePlusDense(IntBuffer buf) {
int length = buf.capacity();
nnz = 0;
int value;
for (int i = 0; i < length; i++) {
value = denseRep.get(i) + buf.get(i);
if (value != 0) {
denseRep.put(i, denseRep.get(i) + buf.get(i));
nnz++;
}
}
if (nnz < threshold)
denseToSparse();
}
示例6: bufToIntegerString
import java.nio.IntBuffer; //导入方法依赖的package包/类
protected String bufToIntegerString(IntBuffer buf) {
String str = "";
for (int i = 0; i < buf.capacity(); i++) {
str += buf.get(i);
}
return str.replaceFirst("[^1-9]*", "");
}
示例7: getInt
import java.nio.IntBuffer; //导入方法依赖的package包/类
public int[] getInt(Attribute attrib) {
int pname = getAttrib(attrib);
IntBuffer buf = ByteBuffer.allocateDirect(16).order(ByteOrder.nativeOrder()).asIntBuffer();
gl.glGetIntegerv(pname, buf);
int[] result = new int[buf.capacity()];
for(int i = 0; i < result.length; i++)
result[i] = buf.get();
return result;
}
示例8: AddVertices
import java.nio.IntBuffer; //导入方法依赖的package包/类
public void AddVertices(FloatBuffer vertices, IntBuffer indices)
{
shader = new Shader("forward-ambient2");
material = new Material(new Texture("bricks.jpg"), 1, 8,
new Texture("bricks_normal.jpg"), new Texture("bricks_disp.png"), 0.03f, -0.5f);
resource = new MeshResource(indices.capacity());
glBindBuffer(GL_ARRAY_BUFFER, resource.GetVbo());
glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, resource.GetIbo());
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW);
}
示例9: BufferDirectDictionaryLinkCellManager
import java.nio.IntBuffer; //导入方法依赖的package包/类
public BufferDirectDictionaryLinkCellManager( final ColumnType columnType , final IDicManager dicManager , final IntBuffer dicIndexIntBuffer ){
this.columnType = columnType;
this.dicManager = dicManager;
this.dicIndexIntBuffer = dicIndexIntBuffer;
indexSize = dicIndexIntBuffer.capacity();
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:7,代码来源:BufferDirectDictionaryLinkCellManager.java