Java BufferedInputStream Create toBufferedInputStream(InputStream stream)

Here you can find the source of toBufferedInputStream(InputStream stream)

Description

to Buffered Input Stream

License

Open Source License

Declaration

private static InputStream toBufferedInputStream(InputStream stream) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
     //from   w w  w . j  a v a2s  . co m
 *******************************************************************************/

import java.io.BufferedInputStream;

import java.io.InputStream;

public class Main {
    private static final int DEFAULT_READING_SIZE = 8192;

    private static InputStream toBufferedInputStream(InputStream stream) {
        if (stream instanceof BufferedInputStream) {
            return stream;
        } else {
            return new BufferedInputStream(stream, DEFAULT_READING_SIZE);
        }
    }
}

Related

  1. getStream(String string)
  2. getStream(String string, String codePage)
  3. getStreamFromString(String text)
  4. inputStreamBuffered(final File file)
  5. toBufferedInputStream(InputStream inputStream)