code: public static void writeBytes(byte[] bytes, OutputStream os) throws IOException {
  		
  		BufferedOutputStream bos = new BufferedOutputStream(os);
  		
  		ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
  		
  		byte[] buf = new byte[1028];
  		
  		int len;
  		while ((len = bis.read(buf, 0, buf.length)) > -1){
  			bos.write(buf, 0, len);
  		}
  		
  		bos.flush();
  		bos.close();
  		
  		bis.close();
  	}
docs: Helper method to write bytes to a OutputStream.