cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/reading DatabaseReader.java
Date Mon, 12 Mar 2001 17:56:18 GMT
bloritsch    01/03/12 09:56:18

  Modified:    src/org/apache/cocoon/reading Tag: xml-cocoon2
                        DatabaseReader.java
  Log:
  Fixed problem with using buffered reader, and made optimizations for memmory
  with large resources.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +10 -6     xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java
  
  Index: DatabaseReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- DatabaseReader.java	2001/03/12 05:55:23	1.1.2.6
  +++ DatabaseReader.java	2001/03/12 17:56:18	1.1.2.7
  @@ -213,12 +213,8 @@
               throw new SQLException("The Blob is empty!");
           }
   
  -        InputStream is = object.getBinaryStream();
  +        InputStream is = new BufferedInputStream(object.getBinaryStream());
   
  -        byte[] bytes = new byte[(int) object.length()];
  -        is.read(bytes);
  -        is.close();
  -
           response.setContentLength((int) object.length());
           long expires = parameters.getParameterAsInteger("expires", -1);
   
  @@ -227,6 +223,14 @@
           }
   
           response.setHeader("Accept-Ranges", "bytes");
  -        out.write(bytes);
  +
  +        byte[] buffer = new byte[8192];
  +        int length = -1;
  +
  +        while ((length = is.read(buffer)) > -1) {
  +            out.write(buffer, 0, length);
  +        }
  +        is.close();
  +        out.flush();
       }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message