本文整理汇总了Java中org.tukaani.xz.lzma.LZMAEncoder类的典型用法代码示例。如果您正苦于以下问题:Java LZMAEncoder类的具体用法?Java LZMAEncoder怎么用?Java LZMAEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LZMAEncoder类属于org.tukaani.xz.lzma包,在下文中一共展示了LZMAEncoder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: LZMA2Encoder
点赞 3
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
LZMA2Encoder(LZMA2Options options) {
if (options.getPresetDict() != null)
throw new IllegalArgumentException(
"XZ doesn't support a preset dictionary for now");
if (options.getMode() == LZMA2Options.MODE_UNCOMPRESSED) {
props[0] = (byte)0;
} else {
int d = Math.max(options.getDictSize(),
LZMA2Options.DICT_SIZE_MIN);
props[0] = (byte)(LZMAEncoder.getDistSlot(d - 1) - 23);
}
// Make a private copy so that the caller is free to change its copy.
this.options = (LZMA2Options)options.clone();
}
开发者ID:dbrant,
项目名称:zimdroid,
代码行数:17,
代码来源:LZMA2Encoder.java
示例2: LZMA2OutputStream
点赞 3
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
LZMA2OutputStream(FinishableOutputStream out, LZMA2Options options) {
if (out == null)
throw new NullPointerException();
this.out = out;
outData = new DataOutputStream(out);
rc = new RangeEncoderToBuffer(COMPRESSED_SIZE_MAX);
int dictSize = options.getDictSize();
int extraSizeBefore = getExtraSizeBefore(dictSize);
lzma = LZMAEncoder.getInstance(rc,
options.getLc(), options.getLp(), options.getPb(),
options.getMode(),
dictSize, extraSizeBefore, options.getNiceLen(),
options.getMatchFinder(), options.getDepthLimit());
lz = lzma.getLZEncoder();
byte[] presetDict = options.getPresetDict();
if (presetDict != null && presetDict.length > 0) {
lz.setPresetDict(dictSize, presetDict);
dictResetNeeded = false;
}
props = (options.getPb() * 5 + options.getLp()) * 9 + options.getLc();
}
开发者ID:dbrant,
项目名称:zimdroid,
代码行数:27,
代码来源:LZMA2OutputStream.java
示例3: LZMA2OutputStream
点赞 3
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
LZMA2OutputStream(FinishableOutputStream out, LZMA2Options options) {
if (out == null)
throw new NullPointerException();
this.out = out;
outData = new DataOutputStream(out);
rc = new RangeEncoder(COMPRESSED_SIZE_MAX);
int dictSize = options.getDictSize();
int extraSizeBefore = getExtraSizeBefore(dictSize);
lzma = LZMAEncoder.getInstance(rc,
options.getLc(), options.getLp(), options.getPb(),
options.getMode(),
dictSize, extraSizeBefore, options.getNiceLen(),
options.getMatchFinder(), options.getDepthLimit());
lz = lzma.getLZEncoder();
byte[] presetDict = options.getPresetDict();
if (presetDict != null && presetDict.length > 0) {
lz.setPresetDict(dictSize, presetDict);
dictResetNeeded = false;
}
props = (options.getPb() * 5 + options.getLp()) * 9 + options.getLc();
}
开发者ID:eclipse,
项目名称:packagedrone,
代码行数:27,
代码来源:LZMA2OutputStream.java
示例4: LZMA2OutputStream
点赞 3
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
LZMA2OutputStream(FinishableOutputStream out, LZMA2Options options) {
if (out == null)
throw new NullPointerException();
this.out = out;
outData = new DataOutputStream(out);
rc = new RangeEncoder(COMPRESSED_SIZE_MAX);
int dictSize = options.getDictSize();
int extraSizeBefore = getExtraSizeBefore(dictSize);
lzma = LZMAEncoder.getInstance(rc, options.getLc(), options.getLp(),
options.getPb(), options.getMode(), dictSize, extraSizeBefore,
options.getNiceLen(), options.getMatchFinder(),
options.getDepthLimit());
lz = lzma.getLZEncoder();
byte[] presetDict = options.getPresetDict();
if (presetDict != null && presetDict.length > 0) {
lz.setPresetDict(dictSize, presetDict);
dictResetNeeded = false;
}
props = (options.getPb() * 5 + options.getLp()) * 9 + options.getLc();
}
开发者ID:anadon,
项目名称:JLS,
代码行数:26,
代码来源:LZMA2OutputStream.java
示例5: getMemoryUsage
点赞 2
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
static int getMemoryUsage(LZMA2Options options) {
// 64 KiB buffer for the range encoder + a little extra + LZMAEncoder
int dictSize = options.getDictSize();
int extraSizeBefore = getExtraSizeBefore(dictSize);
return 70 + LZMAEncoder.getMemoryUsage(options.getMode(),
dictSize, extraSizeBefore,
options.getMatchFinder());
}
开发者ID:dbrant,
项目名称:zimdroid,
代码行数:9,
代码来源:LZMA2OutputStream.java
示例6: LZMA2Encoder
点赞 2
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
LZMA2Encoder(LZMA2Options options) {
if (options.getPresetDict() != null)
throw new IllegalArgumentException(
"XZ doesn't support a preset dictionary for now");
if (options.getMode() == LZMA2Options.MODE_UNCOMPRESSED) {
props[0] = (byte) 0;
} else {
int d = Math.max(options.getDictSize(), LZMA2Options.DICT_SIZE_MIN);
props[0] = (byte) (LZMAEncoder.getDistSlot(d - 1) - 23);
}
// Make a private copy so that the caller is free to change its copy.
this.options = (LZMA2Options) options.clone();
}
开发者ID:anadon,
项目名称:JLS,
代码行数:16,
代码来源:LZMA2Encoder.java
示例7: getMemoryUsage
点赞 2
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
static int getMemoryUsage(LZMA2Options options) {
// 64 KiB buffer for the range encoder + a little extra + LZMAEncoder
int dictSize = options.getDictSize();
int extraSizeBefore = getExtraSizeBefore(dictSize);
return 70 + LZMAEncoder.getMemoryUsage(options.getMode(), dictSize,
extraSizeBefore, options.getMatchFinder());
}
开发者ID:anadon,
项目名称:JLS,
代码行数:8,
代码来源:LZMA2OutputStream.java
示例8: LZMAOutputStream
点赞 2
import org.tukaani.xz.lzma.LZMAEncoder; //导入依赖的package包/类
private LZMAOutputStream(OutputStream out, LZMA2Options options,
boolean useHeader, boolean useEndMarker,
long expectedUncompressedSize)
throws IOException {
if (out == null)
throw new NullPointerException();
// -1 indicates unknown and >= 0 are for known sizes.
if (expectedUncompressedSize < -1)
throw new IllegalArgumentException(
"Invalid expected input size (less than -1)");
this.useEndMarker = useEndMarker;
this.expectedUncompressedSize = expectedUncompressedSize;
this.out = out;
rc = new RangeEncoderToStream(out);
int dictSize = options.getDictSize();
lzma = LZMAEncoder.getInstance(rc,
options.getLc(), options.getLp(), options.getPb(),
options.getMode(),
dictSize, 0, options.getNiceLen(),
options.getMatchFinder(), options.getDepthLimit());
lz = lzma.getLZEncoder();
byte[] presetDict = options.getPresetDict();
if (presetDict != null && presetDict.length > 0) {
if (useHeader)
throw new UnsupportedOptionsException(
"Preset dictionary cannot be used in .lzma files "
+ "(try a raw LZMA stream instead)");
lz.setPresetDict(dictSize, presetDict);
}
props = (options.getPb() * 5 + options.getLp()) * 9 + options.getLc();
if (useHeader) {
// Props byte stores lc, lp, and pb.
out.write(props);
// Dictionary size is stored as a 32-bit unsigned little endian
// integer.
for (int i = 0; i < 4; ++i) {
out.write(dictSize & 0xFF);
dictSize >>>= 8;
}
// Uncompressed size is stored as a 64-bit unsigned little endian
// integer. The max value (-1 in two's complement) indicates
// unknown size.
for (int i = 0; i < 8; ++i)
out.write((int)(expectedUncompressedSize >>> (8 * i)) & 0xFF);
}
}
开发者ID:dbrant,
项目名称:zimdroid,
代码行数:58,
代码来源:LZMAOutputStream.java