ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs LoadFile.java LoadProperties.java
Date Thu, 28 Feb 2002 19:43:01 GMT
umagesh     02/02/28 11:43:01

  Modified:    proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/filters/util
                        ChainReaderHelper.java
               proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs
                        LoadFile.java LoadProperties.java
  Log:
  Split processStream into two methods to facilitate streamed reads...
    Reader getAssembledReader()
    String readFully(Reader)
  
  Revision  Changes    Path
  1.2       +13 -6     jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
  
  Index: ChainReaderHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChainReaderHelper.java	28 Feb 2002 18:23:38 -0000	1.1
  +++ ChainReaderHelper.java	28 Feb 2002 19:43:01 -0000	1.2
  @@ -114,17 +114,14 @@
       }
   
       /**
  -     * Process the reader chain
  +     * Assemble the reader
        */
  -    public final String processStream()
  -        throws BuildException, IOException {
  -
  +    public final Reader getAssembledReader() throws BuildException {
           if (primaryReader == null) {
               throw new BuildException("primaryReader must not be null.");
           }
   
           Reader instream = primaryReader;
  -        final char[] buffer = new char[bufferSize];
           final int filterReadersCount = filterChains.size();
           final Vector finalFilters = new Vector();
   
  @@ -201,11 +198,21 @@
                   }
               }
           }
  +        return instream;
  +    }
   
  +    /**
  +     * Read data from the reader and return the
  +     * contents as a string.
  +     */
  +    public final String readFully(Reader rdr)
  +        throws IOException {
  +
  +        final char[] buffer = new char[bufferSize];
           int bufferLength = 0;
           String text = null;
           while (bufferLength != -1) {
  -            bufferLength = instream.read(buffer);
  +            bufferLength = rdr.read(buffer);
               if (bufferLength != -1) {
                   if (text == null) {
                       text = new String(buffer, 0, bufferLength);
  
  
  
  1.10      +2 -1      jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadFile.java
  
  Index: LoadFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadFile.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LoadFile.java	28 Feb 2002 18:23:38 -0000	1.9
  +++ LoadFile.java	28 Feb 2002 19:43:01 -0000	1.10
  @@ -194,8 +194,9 @@
               crh.setBufferSize(size);
               crh.setPrimaryReader(instream);
               crh.setFilterChains(filterChains);
  +            instream = crh.getAssembledReader();
   
  -            String text = crh.processStream();
  +            String text = crh.readFully(instream);
   
               if (text != null) {
                   if(evaluateProperties) {
  
  
  
  1.8       +2 -1      jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
  
  Index: LoadProperties.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LoadProperties.java	28 Feb 2002 19:16:36 -0000	1.7
  +++ LoadProperties.java	28 Feb 2002 19:43:01 -0000	1.8
  @@ -128,8 +128,9 @@
               crh.setBufferSize(size);
               crh.setPrimaryReader(instream);
               crh.setFilterChains(filterChains);
  +            instream = crh.getAssembledReader();
   
  -            String text = crh.processStream();
  +            String text = crh.readFully(instream);
   
               if (text != null) {
                   if (!text.endsWith("\n")) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message