I have the following, which fails to print a string to console as I would expect it to:
String url = "http://mis.ercot.com/misdownload/servlets/mirDownload?
mimic_duns=000000000&doclookupId=698819309";
URL obj = new URL(url.trim());
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
conn.getResponseCode();
InputStream stream = conn.getInputStream();
ZipInputStream zis = new ZipInputStream(stream);
byte[] buffer = new byte[1024];
int i = zis.read(buffer);
String str = new String(buffer, StandardCharsets.UTF_8);
System.out.println(str);
At the URL, there is zip file, which has an XML file which I need to eventually parse, but for now I will be satisfied to simply print it to the console, and thus confirm I have succesfully unzipped the file.
Something like the following does indeed generate the correct name of the file:
ZipEntry ze = zis.getNextEntry();
System.out.println(ze);
Thus I know I am on the right track, but I do not need the name of the file, I do not even need the file, I need the XML entries, because my eventual goal is to persist to SQL.