本文整理了Java中lzma.sdk.lzma.Encoder.code()
方法的一些代码示例,展示了Encoder.code()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.code()
方法的具体详情如下:
包路径:lzma.sdk.lzma.Encoder
类名称:Encoder
方法名:code
暂无
代码示例来源:origin: netty/netty
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: redisson/redisson
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: wildfly/wildfly
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: com.github.danny02/JOpenCTM
@Override
public void code(InputStream in, OutputStream out) throws IOException {
//both int attributes aren't used inside the method
e.code(in, out, -1, -1, null);
}
}
代码示例来源:origin: com.github.jponge/lzma-java
@Override
public void code(final InputStream in, final OutputStream out)
throws IOException
{
encoder.writeCoderProperties(out);
// write -1 as "unknown" for file size
out.write(MINUS_ONE);
encoder.code(in, out, -1, -1, null);
}
代码示例来源:origin: jponge/lzma-java
@Override
public void code(final InputStream in, final OutputStream out)
throws IOException
{
encoder.writeCoderProperties(out);
// write -1 as "unknown" for file size
out.write(MINUS_ONE);
encoder.code(in, out, -1, -1, null);
}
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: io.netty/netty-codec
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: apache/activemq-artemis
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: com.github.danny02/JOpenCTM
public void writeCompressedData(byte[] data) throws IOException {
//some magic size as in the OpenCTM reference implementation
ByteArrayOutputStream bout = new ByteArrayOutputStream(1000 + data.length);
Encoder enc = new Encoder();
enc.setEndMarkerMode(false);
if (compressionLevel <= 5) {
enc.setDictionarySize(1 << (compressionLevel * 2 + 14));
} else if (compressionLevel == 6) {
enc.setDictionarySize(1 << 25);
} else {
enc.setDictionarySize(1 << 26);
}
enc.setNumFastBytes(compressionLevel < 7 ? 32 : 64);
enc.code(new ByteArrayInputStream(data), bout, data.length, -1, null);
// try (OutputStream lzout = new LzmaOutputStream(bout, new CustomWrapper(enc))) {
// lzout.write(data);
// }
//This is the custom way of OpenCTM to write the LZMA properties
this.writeLittleInt(bout.size());
enc.writeCoderProperties(this);
bout.writeTo(this);
// write(data);
}
代码示例来源:origin: apache/activemq-artemis
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-netty
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: com.datastax.oss/java-driver-core-shaded
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: org.apache.ratis/ratis-proto-shaded
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: io.bitsensor/proto
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
代码示例来源:origin: KostyaSha/yet-another-docker-plugin
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
final int length = in.readableBytes();
InputStream bbIn = null;
ByteBufOutputStream bbOut = null;
try {
bbIn = new ByteBufInputStream(in);
bbOut = new ByteBufOutputStream(out);
bbOut.writeByte(properties);
bbOut.writeInt(littleEndianDictionarySize);
bbOut.writeLong(Long.reverseBytes(length));
encoder.code(bbIn, bbOut, -1, -1, null);
} finally {
if (bbIn != null) {
bbIn.close();
}
if (bbOut != null) {
bbOut.close();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!