java.util.zip.GZIPInputStream.readFully()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中java.util.zip.GZIPInputStream.readFully()方法的一些代码示例,展示了GZIPInputStream.readFully()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GZIPInputStream.readFully()方法的具体详情如下:
包路径:java.util.zip.GZIPInputStream
类名称:GZIPInputStream
方法名:readFully

GZIPInputStream.readFully介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: robovm/robovm

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: MobiVM/robovm

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: ibinti/bugvm

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekIntLE(b, 0) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekIntLE(b, 4) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: FlexoVM/flexovm

private void verifyCrc() throws IOException {
  // Get non-compressed bytes read by fill
  int size = inf.getRemaining();
  final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes)
  byte[] b = new byte[trailerSize];
  int copySize = (size > trailerSize) ? trailerSize : size;
  System.arraycopy(buf, len - size, b, 0, copySize);
  readFully(b, copySize, trailerSize - copySize);
  if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) {
    throw new IOException("CRC mismatch");
  }
  if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) {
    throw new IOException("Size mismatch");
  }
}

代码示例来源:origin: MobiVM/robovm

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: ibinti/bugvm

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: com.bugvm/bugvm-rt

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: com.gluonhq/robovm-rt

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: com.jtransc/jtransc-rt

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShortLE(header, 0);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShortLE(header, 0);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

代码示例来源:origin: FlexoVM/flexovm

super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
short magic = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
if (magic != (short) GZIP_MAGIC) {
  readFully(header, 0, 2);
  if (hcrc) {
    crc.update(header, 0, 2);
  readFully(header, 0, 2);
  short crc16 = Memory.peekShort(header, 0, ByteOrder.LITTLE_ENDIAN);
  if ((short) crc.getValue() != crc16) {

相关文章