You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by tb...@apache.org on 2012/03/09 11:02:30 UTC

svn commit: r1298775 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io: RandomAccess.java RandomAccessRead.java SequentialRead.java

Author: tboehme
Date: Fri Mar  9 10:02:29 2012
New Revision: 1298775

URL: http://svn.apache.org/viewvc?rev=1298775&view=rev
Log:
as proposed in PDFBOX-1211 some methods of RandomAccess interface are moved to new RandomAccessRead and SequentialRead which now build a hierarchy 

Added:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java   (with props)
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java   (with props)
Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java?rev=1298775&r1=1298774&r2=1298775&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java Fri Mar  9 10:02:29 2012
@@ -25,55 +25,10 @@ import java.io.IOException;
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.2 $
  */
-public interface RandomAccess
+public interface RandomAccess extends RandomAccessRead
 {
 
     /**
-     * Release resources that are being held.
-     *
-     * @throws IOException If there is an error closing this resource.
-     */
-    public void close() throws IOException;
-
-    /**
-     * Seek to a position in the data.
-     *
-     * @param position The position to seek to.
-     * @throws IOException If there is an error while seeking.
-     */
-    public void seek(long position) throws IOException;
-
-    /**
-     * Read a single byte of data.
-     *
-     * @return The byte of data that is being read.
-     *
-     * @throws IOException If there is an error while reading the data.
-     */
-    public int read() throws IOException;
-
-    /**
-     * Read a buffer of data.
-     *
-     * @param b The buffer to write the data to.
-     * @param offset Offset into the buffer to start writing.
-     * @param length The amount of data to attempt to read.
-     * @return The number of bytes that were actually read.
-     * @throws IOException If there was an error while reading the data.
-     */
-    public int read(byte[] b, int offset, int length) throws IOException;
-
-    /**
-     * The total number of bytes that are available.
-     *
-     * @return The number of bytes available.
-     *
-     * @throws IOException If there is an IO error while determining the
-     * length of the data stream.
-     */
-    public long length() throws IOException;
-
-    /**
      * Write a byte to the stream.
      *
      * @param b The byte to write.

Added: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java?rev=1298775&view=auto
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java (added)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java Fri Mar  9 10:02:29 2012
@@ -0,0 +1,45 @@
+/*
+ * 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.pdfbox.io;
+
+import java.io.IOException;
+
+/**
+ * An interface allowing random access read operations.
+ */
+public interface RandomAccessRead extends SequentialRead
+{
+
+    /**
+     * Seek to a position in the data.
+     *
+     * @param position The position to seek to.
+     * @throws IOException If there is an error while seeking.
+     */
+    public void seek(long position) throws IOException;
+
+    /**
+     * The total number of bytes that are available.
+     *
+     * @return The number of bytes available.
+     *
+     * @throws IOException If there is an IO error while determining the
+     * length of the data stream.
+     */
+    public long length() throws IOException;
+
+}

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java?rev=1298775&view=auto
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java (added)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java Fri Mar  9 10:02:29 2012
@@ -0,0 +1,54 @@
+/*
+ * 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.pdfbox.io;
+
+import java.io.IOException;
+
+/**
+ * An interface allowing sequential read operations.
+ */
+public interface SequentialRead
+{
+
+    /**
+     * Release resources that are being held.
+     *
+     * @throws IOException If there is an error closing this resource.
+     */
+    public void close() throws IOException;
+
+    /**
+     * Read a single byte of data.
+     *
+     * @return The byte of data that is being read.
+     *
+     * @throws IOException If there is an error while reading the data.
+     */
+    public int read() throws IOException;
+
+    /**
+     * Read a buffer of data.
+     *
+     * @param b The buffer to write the data to.
+     * @param offset Offset into the buffer to start writing.
+     * @param length The amount of data to attempt to read.
+     * @return The number of bytes that were actually read.
+     * @throws IOException If there was an error while reading the data.
+     */
+    public int read(byte[] b, int offset, int length) throws IOException;
+
+}

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/SequentialRead.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain