abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r428055 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/PeekAheadInputStream.java
Date Wed, 02 Aug 2006 17:04:14 GMT
Author: jmsnell
Date: Wed Aug  2 10:04:13 2006
New Revision: 428055

URL: http://svn.apache.org/viewvc?rev=428055&view=rev
Log:
Synchronizing access to the stream.  

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/PeekAheadInputStream.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/PeekAheadInputStream.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/PeekAheadInputStream.java?rev=428055&r1=428054&r2=428055&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/PeekAheadInputStream.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/PeekAheadInputStream.java
Wed Aug  2 10:04:13 2006
@@ -42,14 +42,14 @@
     this.origsize = initialSize;
   }
 
-  public int clear() {
+  public synchronized int clear() {
     int m = buf.length;
     buf = new byte[origsize];
     pos = origsize;
     return m;
   }
   
-  public int shrink() {
+  public synchronized int shrink() {
     byte[] old = buf;
     if (pos == 0) return 0; // nothing to do
     int n = old.length - pos;
@@ -80,7 +80,7 @@
   }
 
   @Override
-  public void unread(byte[] b, int off, int len) throws IOException {
+  public synchronized void unread(byte[] b, int off, int len) throws IOException {
     if (len > pos && pos + len > buf.length) {
       resize(len-pos);
       pos += len-pos;
@@ -89,7 +89,7 @@
   }
 
   @Override
-  public void unread(int b) throws IOException {
+  public synchronized void unread(int b) throws IOException {
     if (pos == 0) {
       resize(1);
       pos++;
@@ -97,31 +97,31 @@
     super.unread(b);
   }
   
-  public int peek() throws IOException {
+  public synchronized int peek() throws IOException {
     int m = read();
     unread(m);
     return m;
   }
   
-  public int peek(byte[] buf) throws IOException {
+  public synchronized int peek(byte[] buf) throws IOException {
     return peek(buf, 0, buf.length);
   }
   
-  public int peek(byte[] buf, int off, int len) throws IOException {
+  public synchronized int peek(byte[] buf, int off, int len) throws IOException {
     int r = read(buf, off, len);
     unread(buf,off,len);
     return r;
   }
 
   @Override
-  public int read() throws IOException {
+  public synchronized int read() throws IOException {
     int m = super.read();
     if (pos >= buf.length && buf.length > origsize) shrink();
     return m;
   }
 
   @Override
-  public int read(byte[] b, int off, int len) throws IOException {
+  public synchronized int read(byte[] b, int off, int len) throws IOException {
     this.available(); // workaround for a problem in PushbackInputStream, without this, the
amount of bytes read from some streams will be incorrect
     int r = super.read(b, off, len);
     if (pos >= buf.length && buf.length > origsize) shrink();
@@ -129,7 +129,7 @@
   }
 
   @Override
-  public long skip(long n) throws IOException {
+  public synchronized long skip(long n) throws IOException {
     long r = super.skip(n);
     if (pos >= buf.length && buf.length > origsize) shrink();
     return r;



Mime
View raw message