Thursday, June 10, 2021

download zipped/gz file and unzip and use in java

 Example code for downloading a zipped file and unzipping in java

public static void main(String[] args) throws Exception {
String mmdb = "https://someaddress/somefile.gz";
String zipFilename = "somefile.gz";
if (!Files.exists(Path.of(zipFilename))) {
System.out.println(mmdb);
Files.copy(
new URL(mmdb).openStream(),
Paths.get(zipFilename));
try (GZIPInputStream gis = new GZIPInputStream(new FileInputStream(Path.of(zipFilename).toFile()))) {
Files.copy(gis, Path.of(dbFileName));
}
}

SpringApplication.run(Application.class, args);
}

sony xperia 10 VI did not like the case

After iphone 16 I wanted to test an android and looks like sony xperia 10 VI is nice, which is 6.1 inches, but it was narrow and longer than...