0
votes

I am trying to save the zip file i am receiving from a service call . Below is the code i am trying to save it . Am not getting any error but not getting the extension .

ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream());
FileOutputStream fileOutputStream = new FileOutputStream("C:\\RandD\\IC");// not allowing 
me to save as IC.zip
FileChannel fileChannel = fileOutputStream.getChannel();
fileOutputStream.getChannel().transferFrom(readableByteChannel, 0, Long.MAX_VALUE);

What is the correct way to save the zip file . Looking for most efficient way to do this.

1

1 Answers

0
votes

Try use

<dependency>
  <groupId>net.lingala.zip4j</groupId>
  <artifactId>zip4j</artifactId>
  <version>2.11.1</version> 
</dependency>
new ZipFile("C:\\RandD\\IC")