com.jcraft.jzlib.GZIPInputStream.readHeader()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(120)

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

GZIPInputStream.readHeader介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

public IRubyObject initialize(ThreadContext context, IRubyObject stream) {
  Ruby runtime = context.runtime;
  realIo = stream;
  try {
    // don't close realIO
    ioInputStream = new IOInputStream(realIo);
    io = new GZIPInputStream(ioInputStream, 512, false);
    // JRUBY-4502
    // CRuby expects to parse gzip header in 'new'.
    io.readHeader();
  } catch (IOException e) {
    RaiseException re = RubyZlib.newGzipFileError(runtime, "not in gzip format");
    byte[] input = io.getAvailIn();
    if (input != null && input.length > 0) {
      RubyException rubye = re.getException();
      rubye.setInstanceVariable("@input", 
          RubyString.newString(runtime, new ByteList(input, 0, input.length)));
    }
    throw re;
  }
  position = 0;
  line = 0;
  bufferedStream = new PushbackInputStream(new BufferedInputStream(io), 512);
  return this;
}

代码示例来源:origin: org.jruby/jruby-core

public IRubyObject initialize(ThreadContext context, IRubyObject stream) {
  Ruby runtime = context.runtime;
  realIo = stream;
  try {
    // don't close realIO
    ioInputStream = new IOInputStream(realIo);
    io = new GZIPInputStream(ioInputStream, 512, false);
    // JRUBY-4502
    // CRuby expects to parse gzip header in 'new'.
    io.readHeader();
  } catch (IOException e) {
    RaiseException re = RubyZlib.newGzipFileError(runtime, "not in gzip format");
    byte[] input = io.getAvailIn();
    if (input != null && input.length > 0) {
      RubyException rubye = re.getException();
      rubye.setInstanceVariable("@input", 
          RubyString.newString(runtime, new ByteList(input, 0, input.length)));
    }
    throw re;
  }
  position = 0;
  line = 0;
  bufferedStream = new PushbackInputStream(new BufferedInputStream(io), 512);
  return this;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "initialize", visibility = PRIVATE, compat = RUBY1_8)
public IRubyObject initialize(ThreadContext context, IRubyObject stream) {
  Ruby runtime = context.runtime;
  realIo = stream;
  try {
    // don't close realIO
    ioInputStream = new IOInputStream(realIo);
    io = new GZIPInputStream(ioInputStream, 512, false);
    // JRUBY-4502
    // CRuby expects to parse gzip header in 'new'.
    io.readHeader();
  } catch (IOException e) {
    RaiseException re = RubyZlib.newGzipFileError(runtime, "not in gzip format");
    if (getRuntime().is1_9()) {
      byte[] input = io.getAvailIn();
      if (input != null && input.length > 0) {
        RubyException rubye = re.getException();
        rubye.setInstanceVariable("@input", 
            RubyString.newString(runtime, new ByteList(input, 0, input.length)));
      }
    }
    throw re;
  }
  position = 0;
  line = 0;
  bufferedStream = new BufferedInputStream(io);
  return this;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "initialize", visibility = PRIVATE, compat = RUBY1_8)
public IRubyObject initialize(ThreadContext context, IRubyObject stream) {
  Ruby runtime = context.runtime;
  realIo = stream;
  try {
    // don't close realIO
    ioInputStream = new IOInputStream(realIo);
    io = new GZIPInputStream(ioInputStream, 512, false);
    // JRUBY-4502
    // CRuby expects to parse gzip header in 'new'.
    io.readHeader();
  } catch (IOException e) {
    RaiseException re = RubyZlib.newGzipFileError(runtime, "not in gzip format");
    if (getRuntime().is1_9()) {
      byte[] input = io.getAvailIn();
      if (input != null && input.length > 0) {
        RubyException rubye = re.getException();
        rubye.setInstanceVariable("@input", 
            RubyString.newString(runtime, new ByteList(input, 0, input.length)));
      }
    }
    throw re;
  }
  position = 0;
  line = 0;
  bufferedStream = new BufferedInputStream(io);
  return this;
}

相关文章