本文整理汇总了Java中io.netty.buffer.DrillBuf.getBytes方法的典型用法代码示例。如果您正苦于以下问题:Java DrillBuf.getBytes方法的具体用法?Java DrillBuf.getBytes怎么用?Java DrillBuf.getBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.netty.buffer.DrillBuf
的用法示例。
在下文中一共展示了DrillBuf.getBytes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decompress
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
@Override
public void decompress(DrillBuf input, int compressedSize, DrillBuf output, int uncompressedSize)
throws IOException {
decompressor.reset();
byte[] inputBytes = new byte[input.capacity()];
input.getBytes(0, inputBytes);
decompressor.setInput(inputBytes, 0, inputBytes.length);
byte[] outputBytes = new byte[uncompressedSize];
decompressor.decompress(outputBytes, 0, uncompressedSize);
output.clear();
output.writeBytes(outputBytes);
}
示例2: writeToStream
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
/**
* Serializes the VectorAccessible va and writes it to an output stream
* @param output the OutputStream to write to
* @throws IOException
*/
@Override
public void writeToStream(OutputStream output) throws IOException {
Preconditions.checkNotNull(output);
final Timer.Context timerContext = metrics.timer(WRITER_TIMER).time();
final DrillBuf[] incomingBuffers = batch.getBuffers();
final UserBitShared.RecordBatchDef batchDef = batch.getDef();
/* DrillBuf associated with the selection vector */
DrillBuf svBuf = null;
Integer svCount = null;
if (svMode == BatchSchema.SelectionVectorMode.TWO_BYTE) {
svCount = sv2.getCount();
svBuf = sv2.getBuffer(); //this calls retain() internally
}
try {
/* Write the metadata to the file */
batchDef.writeDelimitedTo(output);
/* If we have a selection vector, dump it to file first */
if (svBuf != null) {
svBuf.getBytes(0, output, svBuf.readableBytes());
sv2.setBuffer(svBuf);
svBuf.release(); // sv2 now owns the buffer
sv2.setRecordCount(svCount);
}
/* Dump the array of ByteBuf's associated with the value vectors */
for (DrillBuf buf : incomingBuffers) {
/* dump the buffer into the OutputStream */
int bufLength = buf.readableBytes();
buf.getBytes(0, output, bufLength);
}
output.flush();
timerContext.stop();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
clear();
}
}
示例3: getBigDecimalFromDrillBuf
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
public static BigDecimal getBigDecimalFromDrillBuf(DrillBuf bytebuf, int start, int length, int scale) {
byte[] value = new byte[length];
bytebuf.getBytes(start, value, 0, length);
BigInteger unscaledValue = new BigInteger(value);
return new BigDecimal(unscaledValue, scale);
}
示例4: nfeL
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
private static int nfeL(int start, int end, DrillBuf buffer){
byte[] buf = new byte[end - start];
buffer.getBytes(start, buf, 0, end - start);
throw new NumberFormatException(new String(buf, com.google.common.base.Charsets.UTF_8));
}
示例5: nfeI
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
private static int nfeI(int start, int end, DrillBuf buffer){
byte[] buf = new byte[end - start];
buffer.getBytes(start, buf, 0, end - start);
throw new NumberFormatException(new String(buf, com.google.common.base.Charsets.UTF_8));
}
示例6: toStringFromUTF8
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
public static String toStringFromUTF8(int start, int end, DrillBuf buffer) {
byte[] buf = new byte[end - start];
buffer.getBytes(start, buf, 0, end - start);
String s = new String(buf, Charsets.UTF_8);
return s;
}
示例7: toStringFromUTF16
import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
public static String toStringFromUTF16(int start, int end, DrillBuf buffer) {
byte[] buf = new byte[end - start];
buffer.getBytes(start, buf, 0, end - start);
return new String(buf, Charsets.UTF_16);
}