Powered By Blogger

Wednesday, October 5, 2011

Converting InputStream to byte for ByteArrayPartSource

InputStream is = null;
int len;
int size = 1024;
byte[] buf = null;

if (is instanceof ByteArrayInputStream) {
size = is.available();
buf = new byte[size];
len = is.read(buf, 0, size);
}


new FilePart(filename, new ByteArrayPartSource("filename.txt", buf));

No comments:

Post a Comment