PageRenderTime 9ms CodeModel.GetById 6ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 1ms

/UniversalImageLoader/src/com/nostra13/universalimageloader/utils/FileUtils.java

https://github.com/rashedulkabir/Android-Universal-Image-Loader
Java | 29 lines | 19 code | 5 blank | 5 comment | 3 complexity | a67d538ce19e47aac5715580fc8f1b80 MD5 | raw file
 1package com.nostra13.universalimageloader.utils;
 2
 3import java.io.IOException;
 4import java.io.InputStream;
 5import java.io.OutputStream;
 6
 7/**
 8 * Provides operations with files
 9 * 
10 * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
11 */
12public final class FileUtils {
13
14	private static final int BUFFER_SIZE = 8 * 1024; // 8 KB 
15
16	private FileUtils() {
17	}
18
19	public static void copyStream(InputStream is, OutputStream os) throws IOException {
20		byte[] bytes = new byte[BUFFER_SIZE];
21		while (true) {
22			int count = is.read(bytes, 0, BUFFER_SIZE);
23			if (count == -1) {
24				break;
25			}
26			os.write(bytes, 0, count);
27		}
28	}
29}