Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
  *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.catalina.util;
Contains commonly needed I/O-related methods

Author(s):
Dan Sandberg
public class IOTools {
    protected final static int DEFAULT_BUFFER_SIZE=4*1024; //4k
    //Ensure non-instantiability
    private IOTools() {
    }

     
Read input from reader and write it to writer until there is no more input from reader.

Parameters:
reader the reader to read from.
writer the writer to write to.
buf the char array to use as a bufferx
    public static void flowReader readerWriter writerchar[] buf ) 
        throws IOException {
        int numRead;
        while ( (numRead = reader.read(buf) ) >= 0) {
            writer.write(buf, 0, numRead);
        }
    }

    
    public static void flowReader readerWriter writer ) 
        throws IOException {
        char[] buf = new char[];
        flowreaderwriterbuf );
    }

    
Read input from input stream and write it to output stream until there is no more input from input stream.

Parameters:
is input stream the input stream to read from.
os output stream the output stream to write to.
buf the byte array to use as a buffer
    public static void flowInputStream isOutputStream osbyte[] buf ) 
        throws IOException {
        int numRead;
        while ( (numRead = is.read(buf) ) >= 0) {
            os.write(buf, 0, numRead);
        }
    }  

    
 
    public static void flowInputStream isOutputStream os ) 
        throws IOException {
        byte[] buf = new byte[];
        flowisosbuf );
    }
New to GrepCode? Check out our FAQ X