-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.fastlz;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-\r
-import org.simantics.fastlz.java.FastLZImpl;\r
-import org.simantics.fastlz.java.FastLZJavaInputStream;\r
-import org.simantics.fastlz.java.FastLZJavaOutputStream;\r
-\r
-/**\r
- * A Java port of the native {@link FastLZ} library.\r
- * \r
- * @author Tuukka Lehtonen\r
- * \r
- * @see FastLZ\r
- * @see FastLZImpl\r
- * @see FastLZJavaInputStream\r
- * @see FastLZJavaOutputStream\r
- */\r
-public class FastLZJava {\r
-\r
- /**\r
- * Compress a block of data in the input buffer and returns the size of\r
- * compressed block. The size of input buffer is specified by length. The\r
- * minimum input buffer size is 16.\r
- * \r
- * <p>\r
- * The output buffer must be at least 5% larger than the input buffer and\r
- * can not be smaller than 66 bytes.\r
- * \r
- * <p>\r
- * If the input is not compressible, the return value might be larger than\r
- * length (input buffer size).\r
- * \r
- * <p>\r
- * The input buffer and the output buffer can not overlap.\r
- */\r
- public static int compress(byte[] input, int inputOffset, int length, byte[] output, int outputOffset) {\r
- return FastLZImpl.fastlz_compress(input, inputOffset, length, output, outputOffset);\r
- }\r
-\r
- /**\r
- * Decompress a block of compressed data and returns the size of the\r
- * decompressed block. If error occurs, e.g. the compressed data is\r
- * corrupted or the output buffer is not large enough, then 0 (zero) will be\r
- * returned instead.\r
- * \r
- * <p>\r
- * The input buffer and the output buffer can not overlap.\r
- * \r
- * <p>\r
- * Decompression is memory safe and guaranteed not to write the output\r
- * buffer more than what is specified in maxout.\r
- */\r
- public static int decompress(byte[] input, int inputOffset, int length, byte[] output, int outputOffset, int maxout) {\r
- return FastLZImpl.fastlz_decompress(input, inputOffset, length, output, outputOffset, maxout);\r
- }\r
-\r
- /**\r
- * @param file the FastLZ-compressed file to read\r
- * @return input stream that decompresses its output using the FastLZ\r
- * algorithm\r
- * @throws FileNotFoundException see\r
- * {@link FileOutputStream#FileOutputStream(File)} for when this is\r
- * thrown\r
- */\r
- public static InputStream read(File file) throws FileNotFoundException {\r
- return new FastLZJavaInputStream(new FileInputStream(file));\r
- }\r
-\r
- /**\r
- * @param file the FastLZ-compressed file to write\r
- * @return output stream that compresses its input using the FastLZ\r
- * algorithm\r
- * @throws FileNotFoundException see\r
- * {@link FileOutputStream#FileOutputStream(File)} for when this is\r
- * thrown\r
- */\r
- public static OutputStream write(File file) throws FileNotFoundException {\r
- return new FastLZJavaOutputStream(new FileOutputStream(file));\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.simantics.fastlz.java.FastLZImpl;
+import org.simantics.fastlz.java.FastLZJavaInputStream;
+import org.simantics.fastlz.java.FastLZJavaOutputStream;
+
+/**
+ * A Java port of the native {@link FastLZ} library.
+ *
+ * @author Tuukka Lehtonen
+ *
+ * @see FastLZ
+ * @see FastLZImpl
+ * @see FastLZJavaInputStream
+ * @see FastLZJavaOutputStream
+ */
+public class FastLZJava {
+
+ /**
+ * Compress a block of data in the input buffer and returns the size of
+ * compressed block. The size of input buffer is specified by length. The
+ * minimum input buffer size is 16.
+ *
+ * <p>
+ * The output buffer must be at least 5% larger than the input buffer and
+ * can not be smaller than 66 bytes.
+ *
+ * <p>
+ * If the input is not compressible, the return value might be larger than
+ * length (input buffer size).
+ *
+ * <p>
+ * The input buffer and the output buffer can not overlap.
+ */
+ public static int compress(byte[] input, int inputOffset, int length, byte[] output, int outputOffset) {
+ return FastLZImpl.fastlz_compress(input, inputOffset, length, output, outputOffset);
+ }
+
+ /**
+ * Decompress a block of compressed data and returns the size of the
+ * decompressed block. If error occurs, e.g. the compressed data is
+ * corrupted or the output buffer is not large enough, then 0 (zero) will be
+ * returned instead.
+ *
+ * <p>
+ * The input buffer and the output buffer can not overlap.
+ *
+ * <p>
+ * Decompression is memory safe and guaranteed not to write the output
+ * buffer more than what is specified in maxout.
+ */
+ public static int decompress(byte[] input, int inputOffset, int length, byte[] output, int outputOffset, int maxout) {
+ return FastLZImpl.fastlz_decompress(input, inputOffset, length, output, outputOffset, maxout);
+ }
+
+ /**
+ * @param file the FastLZ-compressed file to read
+ * @return input stream that decompresses its output using the FastLZ
+ * algorithm
+ * @throws FileNotFoundException see
+ * {@link FileOutputStream#FileOutputStream(File)} for when this is
+ * thrown
+ */
+ public static InputStream read(File file) throws FileNotFoundException {
+ return new FastLZJavaInputStream(new FileInputStream(file));
+ }
+
+ /**
+ * @param file the FastLZ-compressed file to write
+ * @return output stream that compresses its input using the FastLZ
+ * algorithm
+ * @throws FileNotFoundException see
+ * {@link FileOutputStream#FileOutputStream(File)} for when this is
+ * thrown
+ */
+ public static OutputStream write(File file) throws FileNotFoundException {
+ return new FastLZJavaOutputStream(new FileOutputStream(file));
+ }
+
+}