From: jprocter Date: Tue, 24 Apr 2007 16:07:59 +0000 (+0000) Subject: incorrect update approach (attempt prior to hashCode fix in castor-1.1(v)) X-Git-Tag: Release_0.2~140 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=402d89f43732441740c702781c169aabeefc6ded;hp=a79a108a3d7b8542af472029df74947f901a0afa;p=vamsas.git incorrect update approach (attempt prior to hashCode fix in castor-1.1(v)) git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@380 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/uk/ac/vamsas/client/utils/ChecksummedReader.java b/src/uk/ac/vamsas/client/utils/ChecksummedReader.java deleted file mode 100644 index 9861e1d..0000000 --- a/src/uk/ac/vamsas/client/utils/ChecksummedReader.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - */ -package uk.ac.vamsas.client.utils; - -import java.io.IOException; -import java.io.Reader; - -/** - * @author JimP - * Simple wrapper for reader to keep track of position in stream. - * This is used in the document unmarshalling mechanism to compute - * a simple hash based on the distance between the read blocks containing - * the start and end tags of the XML. - */ -public class ChecksummedReader extends Reader { - private Reader myReader=null; - private long count=0; - public ChecksummedReader(Reader myReader) { - super(); - this.myReader = myReader; - count=0; - } - - /* (non-Javadoc) - * @see java.io.Reader#close() - */ - public void close() throws IOException { - if (myReader!=null) - myReader.close(); - else - throw new IOException("Close called on un-inited ChecksummedReader"); - } - - /* (non-Javadoc) - * @see java.io.Reader#read(char[], int, int) - */ - public int read(char[] cbuf, int off, int len) throws IOException { - int rlen = myReader.read(cbuf, off, len); - if (rlen>0) - count+=cbuf.hashCode(); - return rlen; - } - /** - * Return current checksum of read bytes. - * @return stream checksum - */ - public long getChecksum() { - return count; - } - /** - * Return existing checksum value and reset - * @return old count - */ - public long getAndResetChecksum() { - long cnt=count; - count=0; - return cnt; - } -}