commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons-sandbox/io/src/java/org/apache/commons/io EndianUtils.java
Date Fri, 02 Jan 2004 07:53:46 GMT
bayard      2004/01/01 23:53:46

  Modified:    io/src/java/org/apache/commons/io EndianUtils.java
  Log:
  Fixed what I think is a bug in readSwappedLong(InputStream) by rewriting the method to use
the readSwappedLong(byte[])
  
  Revision  Changes    Path
  1.11      +4 -18     jakarta-commons-sandbox/io/src/java/org/apache/commons/io/EndianUtils.java
  
  Index: EndianUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/EndianUtils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EndianUtils.java	2 Jan 2004 07:43:34 -0000	1.10
  +++ EndianUtils.java	2 Jan 2004 07:53:46 -0000	1.11
  @@ -444,23 +444,9 @@
       public static long readSwappedLong( InputStream input )
           throws IOException
       {
  -        int value1 = read( input );
  -        int value2 = read( input );
  -        int value3 = read( input );
  -        int value4 = read( input );
  -        int value5 = read( input );
  -        int value6 = read( input );
  -        int value7 = read( input );
  -        int value8 = read( input );
  -
  -        return (long)( ( ( value1 & 0xff ) << 0 ) +
  -            ( ( value2 & 0xff ) << 8 ) +
  -            ( ( value3 & 0xff ) << 16 ) +
  -            ( ( value4 & 0xff ) << 24 ) +
  -            ( ( value5 & 0xff ) << 32 ) +
  -            ( ( value6 & 0xff ) << 40 ) +
  -            ( ( value7 & 0xff ) << 48 ) +
  -            ( ( value8 & 0xff ) << 56 ) );
  +        byte[] bytes = new byte[8];
  +        input.read( bytes );
  +        return readSwappedLong( bytes, 0 );
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message