Code example for ByteArrayInputStream

Methods: available, close, read

0
        // Very simple code to copy a picture from the application's 
        // resource into the external file.  Note that this code does 
        // no error checking, and assumes the picture is small (does not 
        // try to copy it in chunks).  Note that if external storage is 
        // not currently mounted this will silently fail. 
        InputStream is = new ByteArrayInputStream(outdata);
        OutputStream os = new FileOutputStream(file);
        byte[] data = new byte[is.available()];
        is.read(data);
        os.write(data);
        is.close();
        os.close();
 
    	Uri tmpImageUri = Uri.fromFile(file);
    	 
    	return tmpImageUri;
 
       
    }