热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.jcraft.jzlib.GZIPOutputStream类的使用及代码示例

本文整理了Java中com.jcraft.jzlib.GZIPOutputStream类的一些代码示例,展示了GZIPOutputStream

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

GZIPOutputStream介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

public OutputStream compress(OutputStream out) throws IOException {
return new GZIPOutputStream(new BufferedOutputStream(out));
}
};

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

@Override
@JRubyMethod(name = "close")
public IRubyObject close() {
if (!closed) {
try {
io.close();
if (realIo.respondsTo("close")) {
realIo.callMethod(realIo.getRuntime().getCurrentContext(), "close");
}
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

this.closed = true;

return realIo;
}

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

@JRubyMethod(name = "flush", optiOnal= 1)
public IRubyObject flush(IRubyObject[] args) {
int flush = JZlib.Z_SYNC_FLUSH;

if (args.length > 0 && !args[0].isNil()) {
flush = RubyNumeric.fix2int(args[0]);
}

boolean tmp = io.getSyncFlush();
try {
if (flush != 0 /*
* NO_FLUSH
*/) {
io.setSyncFlush(true);
}
io.flush();
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
} finally {
io.setSyncFlush(tmp);
}

return getRuntime().getNil();
}

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

@JRubyMethod(name = "mtime=", required = 1)
public IRubyObject set_mtime(IRubyObject arg) {
if (arg instanceof RubyTime) {
this.mtime = ((RubyTime) arg);
} else if (arg.isNil()) {
// ...nothing
} else {
this.mtime.setDateTime(new DateTime(RubyNumeric.fix2long(arg) * 1000));
}

try {
io.setModifiedTime(this.mtime.to_i().getLongValue());
} catch (GZIPException e) {
throw RubyZlib.newGzipFileError(getRuntime(), "header is already written");
}

return getRuntime().getNil();
}

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

@Override
@JRubyMethod(name = "crc")
public IRubyObject crc() {
long crc = 0L;

try {
crc = io.getCRC();
} catch (GZIPException e) {
// not calculated yet
}

return getRuntime().newFixnum(crc);
}

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

@JRubyMethod(name = "orig_name=", required = 1)
public IRubyObject set_orig_name(IRubyObject obj) {
nullFreeOrigName = obj.convertToString();
ensureNonNull(nullFreeOrigName);

try {
io.setName(nullFreeOrigName.toString());
} catch (GZIPException e) {
throw RubyZlib.newGzipFileError(getRuntime(), "header is already written");
}

return obj;
}

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

@JRubyMethod(name = "comment=", required = 1)
public IRubyObject set_comment(IRubyObject obj) {
nullFreeComment = obj.convertToString();
ensureNonNull(nullFreeComment);

try {
io.setComment(nullFreeComment.toString());
} catch (GZIPException e) {
throw RubyZlib.newGzipFileError(getRuntime(), "header is already written");
}

return obj;
}

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

private IRubyObject initializeCommon(IRubyObject stream, int level) {
realIo = (RubyObject) stream;
try {
// the 15+16 here is copied from a Deflater default constructor
Deflater deflater = new Deflater(level, 15+16, false);
final IOOutputStream ioOutputStream = new IOOutputStream(realIo, false, false) {
/**
* Customize IOOutputStream#write(byte[], int, int) to create a defensive copy of the byte array
* that GZIPOutputStream hands us.
*
* That byte array is a reference to one of GZIPOutputStream's internal byte buffers.
* The base IOOutputStream#write(byte[], int, int) uses the bytes it is handed to back a
* copy-on-write ByteList. So, without this defensive copy, those two classes overwrite each
* other's bytes, corrupting our output.
*/
@Override
public void write(byte[] bytes, int off, int len) throws IOException {
byte[] bytesCopy = new byte[len];
System.arraycopy(bytes, off, bytesCopy, 0, len);
super.write(bytesCopy, 0, len);
}
};
io = new GZIPOutputStream(ioOutputStream, deflater, 512, false);
return this;
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

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

@Override
public IRubyObject finish() {
if (!finished) {
try {
io.finish();
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

finished = true;

return realIo;
}

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

@JRubyMethod(name = {"pos", "tell"})
public IRubyObject pos() {
return RubyNumeric.int2fix(getRuntime(), io.getTotalIn());
}

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

@Override
@JRubyMethod(name = "close")
public IRubyObject close() {
if (!closed) {
try {
io.close();
if (realIo.respondsTo("close")) {
realIo.callMethod(realIo.getRuntime().getCurrentContext(), "close");
}
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

this.closed = true;

return realIo;
}

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

@JRubyMethod(name = "flush", optiOnal= 1)
public IRubyObject flush(IRubyObject[] args) {
int flush = JZlib.Z_SYNC_FLUSH;

if (args.length > 0 && !args[0].isNil()) {
flush = RubyNumeric.fix2int(args[0]);
}

boolean tmp = io.getSyncFlush();
try {
if (flush != 0 /*
* NO_FLUSH
*/) {
io.setSyncFlush(true);
}
io.flush();
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
} finally {
io.setSyncFlush(tmp);
}

return getRuntime().getNil();
}

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

@JRubyMethod(name = "mtime=", required = 1)
public IRubyObject set_mtime(IRubyObject arg) {
if (arg instanceof RubyTime) {
this.mtime = ((RubyTime) arg);
} else if (arg.isNil()) {
// ...nothing
} else {
this.mtime.setDateTime(new DateTime(RubyNumeric.fix2long(arg) * 1000));
}

try {
io.setModifiedTime(this.mtime.to_i().getLongValue());
} catch (GZIPException e) {
throw RubyZlib.newGzipFileError(getRuntime(), "header is already written");
}

return getRuntime().getNil();
}

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

@Override
@JRubyMethod(name = "crc")
public IRubyObject crc() {
long crc = 0L;

try {
crc = io.getCRC();
} catch (GZIPException e) {
// not calculated yet
}

return getRuntime().newFixnum(crc);
}

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

@JRubyMethod(name = "orig_name=", required = 1)
public IRubyObject set_orig_name(IRubyObject obj) {
nullFreeOrigName = obj.convertToString();
ensureNonNull(nullFreeOrigName);

try {
io.setName(nullFreeOrigName.toString());
} catch (GZIPException e) {
throw RubyZlib.newGzipFileError(getRuntime(), "header is already written");
}

return obj;
}

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

@JRubyMethod(name = "comment=", required = 1)
public IRubyObject set_comment(IRubyObject obj) {
nullFreeComment = obj.convertToString();
ensureNonNull(nullFreeComment);

try {
io.setComment(nullFreeComment.toString());
} catch (GZIPException e) {
throw RubyZlib.newGzipFileError(getRuntime(), "header is already written");
}

return obj;
}

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

private IRubyObject initializeCommon(IRubyObject stream, int level) {
realIo = (RubyObject) stream;
try {
// the 15+16 here is copied from a Deflater default constructor
Deflater deflater = new Deflater(level, 15+16, false);
final IOOutputStream ioOutputStream = new IOOutputStream(realIo, false, false) {
/**
* Customize IOOutputStream#write(byte[], int, int) to create a defensive copy of the byte array
* that GZIPOutputStream hands us.
*
* That byte array is a reference to one of GZIPOutputStream's internal byte buffers.
* The base IOOutputStream#write(byte[], int, int) uses the bytes it is handed to back a
* copy-on-write ByteList. So, without this defensive copy, those two classes overwrite each
* other's bytes, corrupting our output.
*/
@Override
public void write(byte[] bytes, int off, int len) throws IOException {
byte[] bytesCopy = new byte[len];
System.arraycopy(bytes, off, bytesCopy, 0, len);
super.write(bytesCopy, 0, len);
}
};
io = new GZIPOutputStream(ioOutputStream, deflater, 512, false);
return this;
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

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

@Override
public IRubyObject finish() {
if (!finished) {
try {
io.finish();
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

finished = true;

return realIo;
}

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

@JRubyMethod(name = {"pos", "tell"})
public IRubyObject pos() {
return RubyNumeric.int2fix(getRuntime(), io.getTotalIn());
}

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

@Override
@JRubyMethod(name = "close")
public IRubyObject close() {
if (!closed) {
try {
io.close();
if (realIo.respondsTo("close")) {
realIo.callMethod(realIo.getRuntime().getCurrentContext(), "close");
}
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
}
}

this.closed = true;

return getRuntime().getNil();
}

推荐阅读
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文介绍了在iOS开发中使用UITextField实现字符限制的方法,包括利用代理方法和使用BNTextField-Limit库的实现策略。通过这些方法,开发者可以方便地限制UITextField的字符个数和输入规则。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • 使用圣杯布局模式实现网站首页的内容布局
    本文介绍了使用圣杯布局模式实现网站首页的内容布局的方法,包括HTML部分代码和实例。同时还提供了公司新闻、最新产品、关于我们、联系我们等页面的布局示例。商品展示区包括了车里子和农家生态土鸡蛋等产品的价格信息。 ... [详细]
  • 本文介绍了关于Java异常的八大常见问题,包括异常管理的最佳做法、在try块中定义的变量不能用于catch或finally的原因以及为什么Double.parseDouble(null)和Integer.parseInt(null)会抛出不同的异常。同时指出这些问题是由于不同的开发人员开发所导致的,不值得过多思考。 ... [详细]
  • 本文整理了Java中com.evernote.android.job.JobRequest.getTransientExtras()方法的一些代码示例,展示了 ... [详细]
  • 本文介绍了在实现了System.Collections.Generic.IDictionary接口的泛型字典类中如何使用foreach循环来枚举字典中的键值对。同时还讨论了非泛型字典类和泛型字典类在foreach循环中使用的不同类型,以及使用KeyValuePair类型在foreach循环中枚举泛型字典类的优势。阅读本文可以帮助您更好地理解泛型字典类的使用和性能优化。 ... [详细]
  • 本文整理了Java中org.apache.solr.common.SolrDocument.setField()方法的一些代码示例,展示了SolrDocum ... [详细]
  • 在开发中,有时候一个业务上要求的原子操作不仅仅包括数据库,还可能涉及外部接口或者消息队列。此时,传统的数据库事务无法满足需求。本文介绍了Java中如何利用java.lang.Runtime.addShutdownHook方法来保证业务线程的完整性。通过添加钩子,在程序退出时触发钩子,可以执行一些操作,如循环检查某个线程的状态,直到业务线程正常退出,再结束钩子程序。例子程序展示了如何利用钩子来保证业务线程的完整性。 ... [详细]
author-avatar
西北孤狼2502911947
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有