本文整理汇总了Java中org.hsqldb.lib.ArrayUtil.getBinaryMultipleCeiling方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.getBinaryMultipleCeiling方法的具体用法?Java ArrayUtil.getBinaryMultipleCeiling怎么用?Java ArrayUtil.getBinaryMultipleCeiling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.lib.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.getBinaryMultipleCeiling方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deflate
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
private int deflate(byte[] data, int offset, int length, boolean isClob) {
deflater.setInput(data, offset, length);
deflater.finish();
length = deflater.deflate(dataBuffer);
deflater.reset();
if (cryptLobs) {
length = database.logger.getCrypto().encode(dataBuffer, 0, length,
dataBuffer, 0);
}
int limit = (int) ArrayUtil.getBinaryMultipleCeiling(length,
lobBlockSize);
for (int i = length; i < limit; i++) {
dataBuffer[i] = 0;
}
return length;
}
示例2: deflate
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
int deflate(byte[] data, int offset, int length, boolean isClob) {
deflater.setInput(data, offset, length);
deflater.finish();
length = deflater.deflate(dataBuffer);
deflater.reset();
if (cryptLobs) {
length = database.logger.getCrypto().encode(dataBuffer, 0, length,
dataBuffer, 0);
}
int limit = (int) ArrayUtil.getBinaryMultipleCeiling(length,
lobBlockSize);
for (int i = length; i < limit; i++) {
dataBuffer[i] = 0;
}
return length;
}
示例3: calculateDirectorySpaceSize
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
private long calculateDirectorySpaceSize(long blockCount) {
long blockLimit = ArrayUtil.getBinaryMultipleCeiling(blockCount + 1,
blockSize);
long currentSize = IntArrayCachedObject.fileSizeFactor * blockLimit; // root
currentSize += DirectoryBlockCachedObject.fileSizeFactor * blockLimit; // directory
currentSize += bitmapStorageSize * (blockCount + 1); // bitmaps
return currentSize;
}
示例4: getNewBlock
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
long getNewBlock(long rowSize, boolean asBlocks) {
if (asBlocks) {
rowSize = (int) ArrayUtil.getBinaryMultipleCeiling(rowSize,
DataSpaceManager.fixedBlockSizeUnit);
}
if (freshBlockFreePos + rowSize > freshBlockLimit) {
boolean result = getNewMainBlock(rowSize);
if (!result) {
throw Error.error(ErrorCode.DATA_FILE_IS_FULL);
}
}
long position = freshBlockFreePos;
if (asBlocks) {
position = ArrayUtil.getBinaryMultipleCeiling(position,
DataSpaceManager.fixedBlockSizeUnit);
long released = position - freshBlockFreePos;
if (released > 0) {
release(freshBlockFreePos / scale, (int) released);
freshBlockFreePos = position;
}
}
freshBlockFreePos += rowSize;
return position / scale;
}
示例5: setBytesBACompressedPart
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Only for loading parts of the same lob, not for overwriting parts of existing lob
*/
private Result setBytesBACompressedPart(long lobID, long offset,
byte[] dataBytes, int dataLength, boolean isClob) {
// get block offset after existing blocks and compressed block
long[] lastPart = getLastPart(lobID);
int blockOffset = (int) lastPart[ALLOC_PART.BLOCK_OFFSET]
+ (int) lastPart[ALLOC_PART.BLOCK_COUNT];
// check position
long limit = lastPart[ALLOC_PART.PART_OFFSET]
+ lastPart[ALLOC_PART.PART_LENGTH];
if (limit != offset || limit % largeLobBlockSize != 0) {
return Result.newErrorResult(Error.error(ErrorCode.X_0A501,
"compressed lobs"));
}
int byteLength = deflate(dataBytes, 0, dataLength, isClob);
int blockCount = (byteLength + lobBlockSize - 1) / lobBlockSize;
Result result = createFullBlockAddresses(lobID, blockOffset,
blockCount);
if (result.isError()) {
return result;
}
result = createPart(lobID, offset, dataLength, byteLength,
blockOffset, blockCount);
if (result.isError()) {
return result;
}
long blockByteOffset = blockOffset * (long) lobBlockSize;
int blockByteLength =
(int) ArrayUtil.getBinaryMultipleCeiling(byteLength, lobBlockSize);
setBytesBANormal(lobID, blockByteOffset, dataBuffer, blockByteLength);
storeModified = true;
return ResultLob.newLobSetResponse(lobID, dataLength);
}
示例6: setBytesBACompressedPart
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
private Result setBytesBACompressedPart(long lobID, long offset,
byte[] dataBytes, int dataLength, boolean isClob) {
// get block offset after existing blocks and conmpressed block
int byteLength = deflate(dataBytes, 0, dataLength, isClob);
long[] lastPart = getLastPart(lobID);
int blockOffset = (int) lastPart[ALLOC_PART.BLOCK_OFFSET]
+ (int) lastPart[ALLOC_PART.BLOCK_COUNT];
int blockCount = (byteLength + lobBlockSize - 1) / lobBlockSize;
// check position
long limit = lastPart[ALLOC_PART.PART_OFFSET]
+ lastPart[ALLOC_PART.PART_LENGTH];
if (limit != offset || limit % largeLobBlockSize != 0) {
return Result.newErrorResult(Error.error(ErrorCode.X_0F502));
}
Result result = createFullBlockAddresses(lobID, blockOffset,
blockCount);
if (result.isError()) {
return result;
}
result = createPart(lobID, offset, dataLength, byteLength,
blockOffset, blockCount);
if (result.isError()) {
return result;
}
long blockByteOffset = blockOffset * lobBlockSize;
int blockByteLength =
(int) ArrayUtil.getBinaryMultipleCeiling(byteLength, lobBlockSize);
setBytesBANormal(lobID, blockByteOffset, dataBuffer, blockByteLength);
storeModified = true;
return ResultLob.newLobSetResponse(lobID, dataLength);
}