Skip to content

Instantly share code, notes, and snippets.

@mtakemiya
Created November 1, 2011 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtakemiya/1329618 to your computer and use it in GitHub Desktop.
Save mtakemiya/1329618 to your computer and use it in GitHub Desktop.
Unzip and read zipped xml files
package jp.atr.dni.zip.test;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
import java.util.zip.ZipFile;
import org.apache.commons.io.IOUtils;
/**
*
* @author Makoto Takemiya - [武宮 誠] <br />
* ATR - Computational Neuroscience Laboratories, Department of Neuroinformatics
*
* @version 2011/11/01
*/
public class XMLZipTest {
/**
* @param args
* @throws FileNotFoundException
*/
public static void main(String[] args) throws Exception {
ZipFile zipFile = new ZipFile("test_122880.zip");
InputStream in = null;
try {
in = zipFile.getInputStream(zipFile.getEntry("test_122880.xml"));
List<String> strings = IOUtils.readLines(in);
System.out.println(strings);
} finally {
IOUtils.closeQuietly(in);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment