My current situation is I have to read in a file and place it in an InputStream, and then also place the contents of the InputStreaminto a byte array which requires that i know the size of the InputStream. Any ideas?
As requested, i will show the input stream that i am creating from an uploaded file
InputStream uploadedStream = null;
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
java.util.List items = upload.parseRequest(request);
java.util.Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (!item.isFormField()) {
uploadedStream = item.getInputStream();
//CHANGE uploadedStreambyte = item.get()
}
}
request is a HttpServletRequest object, and FileItemFactory adn ServletFileUpload are from Apache Commons FileUpload