本文整理匯總了Java中io.netty.buffer.UnsafeDirectLittleEndian類的典型用法代碼示例。如果您正苦於以下問題:Java UnsafeDirectLittleEndian類的具體用法?Java UnsafeDirectLittleEndian怎麽用?Java UnsafeDirectLittleEndian使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UnsafeDirectLittleEndian類屬於io.netty.buffer包,在下文中一共展示了UnsafeDirectLittleEndian類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSize
import io.netty.buffer.UnsafeDirectLittleEndian; //導入依賴的package包/類
public long getSize(ValueVector v, SizeType type){
long size = 0;
ArrowBuf[] buffers = v.getBuffers(false);
for(ArrowBuf b : buffers){
switch(type){
case ACCOUNTED:
size += b.getActualMemoryConsumed();
break;
case WORSE_CASE:
UnsafeDirectLittleEndian udle = (UnsafeDirectLittleEndian) b.unwrap();
// avoid counting the same underlying buffer multiple times
if (accountedBuffers.containsKey(udle)) {
continue;
}
size += b.getPossibleMemoryConsumed();
accountedBuffers.put(udle, null);
break;
default:
throw new UnsupportedOperationException("Invalid case: " + type.name());
}
}
return size;
}
示例2: dumpBuffers
import io.netty.buffer.UnsafeDirectLittleEndian; //導入依賴的package包/類
private void dumpBuffers(final StringBuilder sb, final Set<BufferLedger> ledgerSet) {
for (final BufferLedger ledger : ledgerSet) {
if (!ledger.isOwningLedger()) {
continue;
}
final UnsafeDirectLittleEndian udle = ledger.getUnderlying();
sb.append("UnsafeDirectLittleEndian[dentityHashCode == ");
sb.append(Integer.toString(System.identityHashCode(udle)));
sb.append("] size ");
sb.append(Integer.toString(udle.capacity()));
sb.append('\n');
}
}
示例3: getUnderlying
import io.netty.buffer.UnsafeDirectLittleEndian; //導入依賴的package包/類
/**
* Package visible for debugging/verification only.
*/
@VisibleForTesting
protected UnsafeDirectLittleEndian getUnderlying() {
return underlying;
}
示例4: verifyAllocator
import io.netty.buffer.UnsafeDirectLittleEndian; //導入依賴的package包/類
/**
* Verifies the accounting state of the allocator. Only works for DEBUG.
*
* @throws IllegalStateException
* when any problems are found
*/
void verifyAllocator() {
final IdentityHashMap<UnsafeDirectLittleEndian, BaseAllocator> buffersSeen = new IdentityHashMap<>();
verifyAllocator(buffersSeen);
}