Android Utililty Methods InputStream Save

List of utility methods to do InputStream Save

Description

The list of methods to do InputStream Save are organized into topic(s).

Method

FilesaveTmpFile(InputStream is)
save Tmp File
File file = getTmpFile();
OutputStream os = new FileOutputStream(file);
byte[] buf = new byte[1024];
int len = 0;
while ((len = is.read(buf)) > 0) {
    os.write(buf, 0, len);
os.flush();
...
voidtoBase64OutputStream(InputStream is, OutputStream os)
Convenience function to copy from inputstream to outputstream
if (is == null) {
    return;
OutputStream osb64 = null;
try {
    osb64 = getBase64OutputStream(os);
    byte[] buf = new byte[1024];
    int count = 0;
...
voidtoOutputStream(InputStream is, OutputStream os)
Convenience function to copy from inputstream to outputstream
if (is == null) {
    return;
try {
    byte[] buf = new byte[1024];
    int count = 0;
    while ((count = is.read(buf)) != -1) {
        os.write(buf, 0, count);
...
voiddoOutputFile(InputStream is, String filename)
do Output File
FileOutputStream os = new FileOutputStream(filename);
BufferedOutputStream bos = new BufferedOutputStream(os, BUFFER_SIZE);
int len;
while ((len = is.read(buf, 0, BUFFER_SIZE)) > 0) {
    bos.write(buf, 0, len);
bos.flush();
bos.close();
...
intwriteFile(File file, InputStream inStream)
write File
long dataSize = 0;
DataInputStream in = null;
DataOutputStream out = null;
if (null != inStream && null != file) {
    try {
        byte buffer[] = new byte[BUFFER];
        out = new DataOutputStream(new FileOutputStream(file));
        in = new DataInputStream(inStream);
...