package kandata.launcher;

import java.io.*;
import java.net.URL;



class Utilities {
	/** URLからバイト配列を取得する。*/
	static byte[] getByteArray(URL url) throws IOException {
		BufferedInputStream in = new BufferedInputStream(url.openStream());
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		BufferedOutputStream out = new BufferedOutputStream(baos);
		byte[] buf = new byte[1024];
		while (true) {
			int bytes = in.read(buf, 0, 1024);
			if (bytes == -1) break;
			out.write(buf, 0, bytes);
		}
		in.close();
		out.close();
		return baos.toByteArray();
	}


}
