Java BufferedOutputStream Create toBuffered(OutputStream stream)

Here you can find the source of toBuffered(OutputStream stream)

Description

to Buffered

License

Open Source License

Declaration

public static BufferedWriter toBuffered(OutputStream stream) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;

public class Main {
    public static BufferedWriter toBuffered(OutputStream stream) {
        return toBuffered(toWriter(stream));
    }/*from   w w  w .j  a  va  2 s .c  o  m*/

    public static BufferedWriter toBuffered(Writer writer) {
        return new BufferedWriter(writer);
    }

    public static BufferedReader toBuffered(InputStream stream) {
        return toBuffered(toReader(stream));
    }

    public static BufferedReader toBuffered(Reader reader) {
        return new BufferedReader(reader);
    }

    public static Writer toWriter(OutputStream stream) {
        return new OutputStreamWriter(stream);
    }

    public static Reader toReader(InputStream stream) {
        return new InputStreamReader(stream);
    }

    public static Reader toReader(byte[] buf, int off, int len) {
        return toReader(new ByteArrayInputStream(buf, off, len));
    }
}

Related

  1. toBufferedDataOutputStream(final OutputStream outputStream)
  2. toBufferedOutputStream(OutputStream os)
  3. toBufferedStream(InputStream is)