Code example for ByteArrayInputStream

Methods: available, 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();
             
            /* 
 
	    	  // Tell the media scanner about the new file so that it is 
	        // immediately available to the user. 
	        MediaScannerConnection.scanFile(this, 
	                new String[] { file.toString() }, null, 
	                new MediaScannerConnection.OnScanCompletedListener() { 
	            public void onScanCompleted(String path, Uri uri) {