X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.fastlz%2Fsrc%2Forg%2Fsimantics%2Ffastlz%2Fjava%2FFastLZJavaInputStream.java;h=360f6c0a2516070aa0617f2496f19b590de80f00;hb=refs%2Fchanges%2F38%2F238%2F2;hp=290990b8deb0ccccbaea09ae7850ed3e8a266e77;hpb=f23dc81afe57e77d20706a9a94002ce4c72f670d;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.fastlz/src/org/simantics/fastlz/java/FastLZJavaInputStream.java b/bundles/org.simantics.fastlz/src/org/simantics/fastlz/java/FastLZJavaInputStream.java index 290990b8d..360f6c0a2 100644 --- a/bundles/org.simantics.fastlz/src/org/simantics/fastlz/java/FastLZJavaInputStream.java +++ b/bundles/org.simantics.fastlz/src/org/simantics/fastlz/java/FastLZJavaInputStream.java @@ -1,60 +1,60 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.fastlz.java; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.nio.channels.ReadableByteChannel; - -import org.simantics.compressions.impl.DecompressingInputStream; -import org.simantics.fastlz.FastLZJava; - -/** - * @author Tuukka Lehtonen - */ -public class FastLZJavaInputStream extends DecompressingInputStream { - - public FastLZJavaInputStream(File file) throws FileNotFoundException { - super(file); - } - - public FastLZJavaInputStream(FileInputStream stream) { - super(stream); - } - - public FastLZJavaInputStream(InputStream stream) { - super(stream); - } - - public FastLZJavaInputStream(InputStream stream, ReadableByteChannel channel) { - super(stream, channel); - } - - @Override - protected ByteBuffer allocateBuffer(int capacity) { - return ByteBuffer.allocate(capacity); - } - - @Override - public void decompress(ByteBuffer compressed, int compressedOffset, int compressedSize, ByteBuffer uncompressed, - int uncompressedOffset, int uncompressedSize) throws IOException { - int decompressed = FastLZJava.decompress(compressed.array(), 0, - compressedSize, uncompressed.array(), 0, uncompressedSize); - if (decompressed != uncompressedSize) - throw new IOException("decompressed " + decompressed + " bytes when " + uncompressedSize + " bytes were expected."); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 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.fastlz.java; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.channels.ReadableByteChannel; + +import org.simantics.compressions.impl.DecompressingInputStream; +import org.simantics.fastlz.FastLZJava; + +/** + * @author Tuukka Lehtonen + */ +public class FastLZJavaInputStream extends DecompressingInputStream { + + public FastLZJavaInputStream(File file) throws FileNotFoundException { + super(file); + } + + public FastLZJavaInputStream(FileInputStream stream) { + super(stream); + } + + public FastLZJavaInputStream(InputStream stream) { + super(stream); + } + + public FastLZJavaInputStream(InputStream stream, ReadableByteChannel channel) { + super(stream, channel); + } + + @Override + protected ByteBuffer allocateBuffer(int capacity) { + return ByteBuffer.allocate(capacity); + } + + @Override + public void decompress(ByteBuffer compressed, int compressedOffset, int compressedSize, ByteBuffer uncompressed, + int uncompressedOffset, int uncompressedSize) throws IOException { + int decompressed = FastLZJava.decompress(compressed.array(), 0, + compressedSize, uncompressed.array(), 0, uncompressedSize); + if (decompressed != uncompressedSize) + throw new IOException("decompressed " + decompressed + " bytes when " + uncompressedSize + " bytes were expected."); + } + +}