Right now i am developing an application using Google App Engine (GAE). GAE doesnt allow me to create temp folder for me to store my zipfile and read from it. The only way is to read it from memory. The zipfile contains 6 CSV files which i need to read it into CSVReader.
//part of the code
MultipartFormDataRequest multiPartRequest = null;
Hashtable files = multiPartRequest.getFiles();
UploadFile userFile = (UploadFile)files.get("bootstrap_file");
InputStream input = userFile.getInpuStream();
ZipInputStream zin = new ZipInputStream(input);
How do i read ZipInputStream into char[] which is needed to create CharArrayReader for my CSVReader object.
CSVReader reader = new CSVReader(CharArrayRead(char[] buf));
Wrap the ZipInputStream with an InputStreamReader to convert from bytes to chars; then call inputStreamReader.read(char[] buf, int offset, int length) to fill your char[] buffer, like this:
if your CharArrayRead is actually a java.io.CharArrayReader, then there is no need to load it into a char[] and you’d be better off with code like this:
If you just have a single zipped file (trying to get around the 1MB limitation) then this will work: