Created
November 1, 2011 01:47
-
-
Save mtakemiya/1329618 to your computer and use it in GitHub Desktop.
Unzip and read zipped xml files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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