Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions

Various stream-related utility methods.

Copyright (c) 2002 Merlin Hughes <> was released by its author under the Apache License, Version 2.0 (the "License") on 9 April 2008; you may not use this file except in compliance with the License. You may obtain a copy of the License at 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.
public class Streams {
  private static final int DEFAULT_BUFFER_SIZE = 8192;
  private Streams () {
  public static void io (InputStream inOutputStream outthrows IOException {
    io (inout);
  public static void io (InputStream inOutputStream outint bufferSizethrows IOException {
    byte[] buffer = new byte[bufferSize];
    int amount;
    while ((amount = (buffer)) >= 0)
      out.write (buffer, 0, amount);
New to GrepCode? Check out our FAQ X