Java / InputStream/OutputStream - Copier

Posted 2007/11/21 10:32, Filed under: 프로그래밍/Java

import java.io.*;

public class Copier
{
	protected InputStream in;
	protected OutputStream out;
	protected byte data[];

	public Copier(InputStream in, OutputStream out, int sz)
	{
		this.in = in;
		this.out = out;
		data = new byte[sz];
	}

	public Copier(InputStream in, OutputStream out)
	{
		this(in, out, 1024);
	}

	public void copy() throws IOException
	{
		int n=0;
		while ((n = in.read(data)) != -1)
		{
			out.write(data, 0, n);
		}
		in.close();
		out.close();
	}
}

2007/11/21 10:32 2007/11/21 10:32

Trackback URL : http://mysilpir.net/trackback/281

Leave a comment

« Previous : 1 : ... 46 : 47 : 48 : 49 : 50 : 51 : 52 : 53 : 54 : ... 270 : Next »

블로그 이미지

일상의 이야기를 나누는 공간입니다.

- 실피

Calendar

    «   2009/01   »
            1 2 3
    4 5 6 7 8 9 10
    11 12 13 14 15 16 17
    18 19 20 21 22 23 24
    25 26 27 28 29 30 31

Total 157585 hit (Today 30, Yesterday 185)

Admin Write Post