Skip to content

Instantly share code, notes, and snippets.

@preslavrachev
Created May 26, 2011 11:46
Show Gist options
  • Save preslavrachev/992978 to your computer and use it in GitHub Desktop.
Save preslavrachev/992978 to your computer and use it in GitHub Desktop.
File file = new File("C:\\Users\\preslav\\DEsktop\\temp.jpg");
byte[] bytes = new byte[file.length()];
InputStream is = new FileInputStream(file);
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0)
{
offset += numRead;
}
parameters.data = bytes;
parameters.filename = "temp.jpg";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment