本文整理了Java中com.questdb.std.Zip
类的一些代码示例,展示了Zip
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zip
类的具体详情如下:
包路径:com.questdb.std.Zip
类名称:Zip
暂无
代码示例来源:origin: bluestreak01/questdb
private void deflate(boolean flush) throws IOException {
int ret;
do {
ret = Zip.deflate(z_streamp, outAddr, outAvail, flush);
if (ret < 0) {
throw new IOException("Deflater error: " + ret);
}
int len = outAvail - Zip.availOut(z_streamp);
if (len > 0) {
out.limit(len).position(0);
channel.write(out);
}
} while (Zip.availIn(z_streamp) > 0 || (flush && ret != 1));
}
代码示例来源:origin: bluestreak01/questdb
private void prepareCompressedBody() {
if (z_streamp == 0) {
z_streamp = Zip.deflateInit();
zout = ByteBuffer.allocateDirect(sz);
pzout = ByteBuffers.getAddress(zout);
}
int r = (int) (_wPtr - outPtr);
Zip.setInput(z_streamp, outPtr, r);
this.crc = Zip.crc32(this.crc, outPtr, r);
this.total += r;
_wPtr = outPtr;
}
代码示例来源:origin: bluestreak01/questdb
private void resetZip() {
if (z_streamp != 0) {
Zip.deflateReset(z_streamp);
}
this.crc = 0;
this.total = 0;
}
代码示例来源:origin: bluestreak01/questdb
long out = Unsafe.malloc(available / 2);
try {
long strm = Zip.deflateInit();
try {
while ((len = (int) Files.read(fdIn, in, available, pIn)) > 0) {
pIn += len;
Zip.setInput(strm, in, len);
crc = Zip.crc32(crc, in, len);
do {
int ret;
if ((ret = Zip.deflate(strm, out, available, false)) < 0) {
throw new FatalError("Error in deflator: " + ret);
int have = available - Zip.availOut(strm);
if (have > 0) {
Files.write(fdOut, out, have, pOut);
} while (Zip.availIn(strm) > 0);
if ((ret = Zip.deflate(strm, out, available, true)) < 0) {
throw new FatalError("Error in deflator: " + ret);
int have = available - Zip.availOut(strm);
if (have > 0) {
Files.write(fdOut, out, have, pOut);
Zip.deflateEnd(strm);
代码示例来源:origin: bluestreak01/questdb
@Override
public int write(ByteBuffer src) throws IOException {
if (!ByteBuffers.isDirect(src)) {
throw new IllegalArgumentException("Heap buffers are not supported");
}
int result = src.remaining();
int pos = src.position();
Zip.setInput(z_streamp, ByteBuffers.getAddress(src) + pos, result);
crc = Zip.crc32(crc, ByteBuffers.getAddress(src) + pos, result);
deflate(false);
src.position(pos + result);
total += result;
return result;
}
代码示例来源:origin: bluestreak01/questdb
@Override
public void close() throws IOException {
flush();
if (channel.isOpen()) {
channel.close();
}
if (z_streamp != 0) {
Zip.deflateEnd(z_streamp);
z_streamp = 0;
}
ByteBuffers.release(out);
}
代码示例来源:origin: bluestreak01/questdb
public GZipWritableChannel(int bufferSize) {
this.out = ByteBuffer.allocateDirect(bufferSize);
this.outAvail = bufferSize;
this.outAddr = ByteBuffers.getAddress(out);
this.z_streamp = Zip.deflateInit();
if (z_streamp <= 0) {
throw new OutOfMemoryError();
}
}
代码示例来源:origin: bluestreak01/questdb
@Override
public int write(ByteBuffer src) throws IOException {
if (!ByteBuffers.isDirect(src)) {
throw new IllegalArgumentException("Heap buffers are not supported");
}
int result = src.remaining();
int pos = src.position();
Zip.setInput(z_streamp, ByteBuffers.getAddress(src) + pos, result);
crc = Zip.crc32(crc, ByteBuffers.getAddress(src) + pos, result);
deflate(false);
src.position(pos + result);
total += result;
return result;
}
代码示例来源:origin: bluestreak01/questdb
@Override
public void close() throws IOException {
flush();
if (channel.isOpen()) {
channel.close();
}
if (z_streamp != 0) {
Zip.deflateEnd(z_streamp);
z_streamp = 0;
}
ByteBuffers.release(out);
}
代码示例来源:origin: bluestreak01/questdb
public GZipWritableChannel(int bufferSize) {
this.out = ByteBuffer.allocateDirect(bufferSize);
this.outAvail = bufferSize;
this.outAddr = ByteBuffers.getAddress(out);
this.z_streamp = Zip.deflateInit();
if (z_streamp <= 0) {
throw new OutOfMemoryError();
}
}
代码示例来源:origin: bluestreak01/questdb
private void deflate(boolean flush) throws IOException {
int ret;
do {
ret = Zip.deflate(z_streamp, outAddr, outAvail, flush);
if (ret < 0) {
throw new IOException("Deflater error: " + ret);
}
int len = outAvail - Zip.availOut(z_streamp);
if (len > 0) {
out.limit(len).position(0);
channel.write(out);
}
} while (Zip.availIn(z_streamp) > 0 || (flush && ret != 1));
}
代码示例来源:origin: bluestreak01/questdb
private void prepareCompressedBody() {
if (z_streamp == 0) {
z_streamp = Zip.deflateInit();
zout = ByteBuffer.allocateDirect(sz);
pzout = ByteBuffers.getAddress(zout);
}
int r = (int) (_wPtr - outPtr);
Zip.setInput(z_streamp, outPtr, r);
this.crc = Zip.crc32(this.crc, outPtr, r);
this.total += r;
_wPtr = outPtr;
}
代码示例来源:origin: bluestreak01/questdb
@Override
public void close() {
ByteBuffers.release(out);
ByteBuffers.release(chunkHeader);
hb.close();
ByteBuffers.release(zout);
if (z_streamp != 0) {
Zip.deflateEnd(z_streamp);
z_streamp = 0;
}
}
代码示例来源:origin: bluestreak01/questdb
private void resetZip() {
if (z_streamp != 0) {
Zip.deflateReset(z_streamp);
}
this.crc = 0;
this.total = 0;
}
代码示例来源:origin: bluestreak01/questdb
ret = Zip.deflate(z_streamp, p, sz, flush);
if (ret < 0) {
LOG.error().$("ZLib error: ").$(ret).$();
len = sz - Zip.availOut(z_streamp);
availIn = Zip.availIn(z_streamp);
} while (len == 0 && availIn > 0);
代码示例来源:origin: bluestreak01/questdb
@Override
public void close() {
ByteBuffers.release(out);
ByteBuffers.release(chunkHeader);
hb.close();
ByteBuffers.release(zout);
if (z_streamp != 0) {
Zip.deflateEnd(z_streamp);
z_streamp = 0;
}
}
代码示例来源:origin: bluestreak01/questdb
private void reset() {
Zip.deflateReset(z_streamp);
crc = 0;
total = 0;
flushed = false;
}
}
代码示例来源:origin: bluestreak01/questdb
ret = Zip.deflate(z_streamp, p, sz, flush);
if (ret < 0) {
LOG.error().$("ZLib error: ").$(ret).$();
len = sz - Zip.availOut(z_streamp);
availIn = Zip.availIn(z_streamp);
} while (len == 0 && availIn > 0);
代码示例来源:origin: bluestreak01/questdb
private void reset() {
Zip.deflateReset(z_streamp);
crc = 0;
total = 0;
flushed = false;
}
}
内容来源于网络,如有侵权,请联系作者删除!