List of utility methods to do InputStream Copy
boolean | copyStream(InputStream src, OutputStream dest) copy Stream byte[] buffer = new byte[COPYSTREAM_BUFFER_SIZE]; try { int size; while ((size = src.read(buffer)) != -1) { dest.write(buffer, 0, size); } catch (IOException e) { return false; ... |
int | copyAllBytes(InputStream in, OutputStream out) copy All Bytes int byteCount = 0; byte[] buffer = new byte[4096]; while (true) { int read = in.read(buffer); if (read == -1) { break; out.write(buffer, 0, read); ... |
void | copyRAWFile(InputStream inStream, File newfile) copy RAW File try { FileOutputStream fs = new FileOutputStream(newfile); copyRAWFile(inStream, fs); fs.close(); } catch (Exception e) { e.printStackTrace(); |
void | copyRAWFile(InputStream inStream, FileOutputStream outStream) copy RAW File try { int bytesum = 0, byteread = 0; byte[] buffer = new byte[102400]; while ((byteread = inStream.read(buffer)) != -1) { bytesum += byteread; System.out.println(bytesum); outStream.write(buffer, 0, byteread); inStream.close(); } catch (Exception e) { e.printStackTrace(); |