X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.lz4%2Fsrc%2Forg%2Fsimantics%2Flz4%2Fimpl%2FLZ4OutputStream.java;h=5ce6211087ff7e78756a22fe674a7266391e816a;hb=e0deb46135b4d11a6c8adf1d11189ca856a2ebb0;hp=e9c8510684243b7f074b98165f6a80c51abe10a8;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.lz4/src/org/simantics/lz4/impl/LZ4OutputStream.java b/bundles/org.simantics.lz4/src/org/simantics/lz4/impl/LZ4OutputStream.java index e9c851068..5ce621108 100644 --- a/bundles/org.simantics.lz4/src/org/simantics/lz4/impl/LZ4OutputStream.java +++ b/bundles/org.simantics.lz4/src/org/simantics/lz4/impl/LZ4OutputStream.java @@ -1,62 +1,62 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.lz4.impl; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.nio.channels.WritableByteChannel; - -import org.simantics.compressions.impl.CompressingOutputStream; -import org.simantics.lz4.LZ4; - -/** - * @author Tuukka Lehtonen - */ -public class LZ4OutputStream extends CompressingOutputStream { - - public LZ4OutputStream(File file) throws FileNotFoundException { - super(file); - } - - public LZ4OutputStream(FileOutputStream stream) { - super(stream); - } - - public LZ4OutputStream(OutputStream output) { - super(output); - } - - - public LZ4OutputStream(OutputStream stream, WritableByteChannel channel) { - super(stream, channel); - } - - @Override - protected int compressBound(int inputSize) { - return LZ4.compressBound(inputSize); - } - - @Override - protected int compress(ByteBuffer uncompressed, int uncompressedOffset, int uncompressedSize, - ByteBuffer compressed, int compressedOffset) throws IOException { - return LZ4.compressBuffer(uncompressed, uncompressedOffset, uncompressedSize, compressed, compressedOffset); - } - - protected ByteBuffer allocateBuffer(int capacity) { - return ByteBuffer.allocateDirect(capacity); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2012 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.lz4.impl; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.ByteBuffer; +import java.nio.channels.WritableByteChannel; + +import org.simantics.compressions.impl.CompressingOutputStream; +import org.simantics.lz4.LZ4; + +/** + * @author Tuukka Lehtonen + */ +public class LZ4OutputStream extends CompressingOutputStream { + + public LZ4OutputStream(File file) throws FileNotFoundException { + super(file); + } + + public LZ4OutputStream(FileOutputStream stream) { + super(stream); + } + + public LZ4OutputStream(OutputStream output) { + super(output); + } + + + public LZ4OutputStream(OutputStream stream, WritableByteChannel channel) { + super(stream, channel); + } + + @Override + protected int compressBound(int inputSize) { + return LZ4.compressBound(inputSize); + } + + @Override + protected int compress(ByteBuffer uncompressed, int uncompressedOffset, int uncompressedSize, + ByteBuffer compressed, int compressedOffset) throws IOException { + return LZ4.compressBuffer(uncompressed, uncompressedOffset, uncompressedSize, compressed, compressedOffset); + } + + protected ByteBuffer allocateBuffer(int capacity) { + return ByteBuffer.allocateDirect(capacity); + } + +}