1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2012 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.lz4.impl;
\r
14 import java.io.File;
\r
15 import java.io.FileInputStream;
\r
16 import java.io.FileNotFoundException;
\r
17 import java.io.InputStream;
\r
18 import java.nio.ByteBuffer;
\r
19 import java.nio.channels.ReadableByteChannel;
\r
21 import org.simantics.compressions.impl.DecompressingInputStream;
\r
22 import org.simantics.lz4.LZ4;
\r
26 * @author Tuukka Lehtonen
\r
28 public class LZ4InputStream extends DecompressingInputStream {
\r
30 public LZ4InputStream(File file) throws FileNotFoundException {
\r
34 public LZ4InputStream(FileInputStream stream) {
\r
38 public LZ4InputStream(InputStream stream) {
\r
42 public LZ4InputStream(InputStream stream, ReadableByteChannel channel) {
\r
43 super(stream, channel);
\r
47 public void decompress(ByteBuffer compressed, int compressedOffset, int compressedSize, ByteBuffer uncompressed,
\r
48 int uncompressedOffset, int uncompressedSize) {
\r
49 LZ4.decompressBuffer(compressed, compressedOffset, compressedSize, uncompressed, uncompressedOffset, uncompressedSize);
\r