com.questdb.std.Zip类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中com.questdb.std.Zip类的一些代码示例,展示了Zip类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zip类的具体详情如下:
包路径:com.questdb.std.Zip
类名称: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;
  }
}

相关文章