Author: mturk
Date: Tue Aug 16 15:41:16 2011
New Revision: 1158328

URL: http://svn.apache.org/viewvc?rev=1158328&view=rev
Log:
Finish up (mostly) the bzip2 api

Added:
    
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Libbzip2.java
   (with props)

Added: 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Libbzip2.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Libbzip2.java?rev=1158328&view=auto
==============================================================================
--- 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Libbzip2.java
 (added)
+++ 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Libbzip2.java
 Tue Aug 16 15:41:16 2011
@@ -0,0 +1,82 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime.util.bzip2;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import org.apache.commons.runtime.InvalidArgumentException;
+import org.apache.commons.runtime.InvalidDataException;
+import org.apache.commons.runtime.InvalidRangeException;
+import org.apache.commons.runtime.OperationNotPermittedException;
+import org.apache.commons.runtime.OverflowException;
+import org.apache.commons.runtime.Pointer;
+import org.apache.commons.runtime.util.StringManager;
+
+/**
+ * Private libbzip2 wrapper.
+ *
+ * @author Mladen Turk
+ * @since Runtime 1.0
+ */
+final class Libbzip2
+{
+
+    /**
+     * Indicates that the bz_stream is in the {@code running} state.
+     */
+    public  static final  byte    BZ_RUN           = 0;
+    /**
+     * Indicates that the bz_stream is in the {@code flushing} state.
+     */
+    public  static final  byte    BZ_FLUSH         = 1;
+    /**
+     * Indicates that the bz_stream is in the {@code finishing} state.
+     */
+    public  static final  byte    BZ_FINISH        = 2;
+
+    private static native int     bzsize0();
+    public  static native long    newStream(int bufferSize)
+        throws OutOfMemoryError;
+    public  static native int     compressInit(long handle, int blockSize100k, 
int workFactor);
+    public  static native int     decompressInit(long handle, boolean small);
+
+    public  static native int     setInput0(long handle, byte[] buf, int off, 
int len);
+    public  static native int     setInput1(long handle, ByteBuffer buf, int 
off, int len);
+    public  static native int     setInput2(long handle, long buf, long len);
+    public  static native void    setInput3(long handle);
+        
+    public  static native int     getAvailIn(long handle);
+    public  static native long    getAvailOut(long handle);
+    public  static native boolean needsInput(long handle);
+    public  static native long    getTotalIn(long handle);
+    public  static native long    getTotalOut(long handle);
+    public  static native boolean flush(long handle);
+    public  static native boolean finish(long handle);
+    public  static native boolean finished(long handle);
+
+    public  static final  int     DEFAULT_BUFFER_SIZE = 4096;
+    public  static final  int     DEFAULT_WORK_FACTOR = 30;
+
+    public  static final  int     SIZEOF_BZ_STREAM;
+
+    static {
+        SIZEOF_BZ_STREAM = bzsize0();       
+    }
+    
+}
+

Propchange: 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Libbzip2.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to