FileDocCategorySizeDatePackage
StreamCopier.javaAPI DocExample517Fri Feb 03 14:27:44 GMT 2006com.elharo.io

StreamCopier

public class StreamCopier extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidcopy(java.io.InputStream in, java.io.OutputStream out)

    
    byte[] buffer = new byte[1024];
    while (true) {
      int bytesRead = in.read(buffer);
      if (bytesRead == -1) break;
      out.write(buffer, 0, bytesRead);
    }
    
  
public static voidmain(java.lang.String[] args)


    try {
      copy(System.in, System.out);
    }
    catch (IOException ex) {
      System.err.println(ex);
    }