Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should create you own stream that can manipulate channels. When the blob size limit is reached your stream closes current channel and opens a new one. </p> <p>Example for local files: </p> <pre><code>public class ZipChannels { public static void main(String[] args) throws IOException { File dirToZip = new File("target\\dependency"); //create zip-files ChannelOutput out = new ChannelOutput(); ZipOutputStream zip = new ZipOutputStream(out); int b = 0; for(File file: dirToZip.listFiles()) { ZipEntry zipEntry = new ZipEntry(file.getName()); zip.putNextEntry(zipEntry); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); while((b = bis.read()) != -1) { zip.write(b); } bis.close(); zip.closeEntry(); } zip.close(); //merge all into one file for check it BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("package_all.zip")); for (int i = 0; i &lt; out.getChannelCount(); i++) { BufferedInputStream bis = new BufferedInputStream(new FileInputStream("package_" + i + ".zip")); while((b = bis.read()) != -1) { bos.write(b); } bis.close(); } bos.close(); } public static class ChannelOutput extends OutputStream { private OutputStream channel; private int count = 0; final private int MAX = 1000000; @Override public void write(int b) throws IOException { if(count++ % MAX == 0) { openNewChannel(); } channel.write(b); } protected void openNewChannel() throws IOException { if(channel != null) { channel.close(); } channel = new BufferedOutputStream(new FileOutputStream("package_" + (count / MAX) + ".zip")); } public int getChannelCount() { return count / MAX + 1; } @Override public void close() throws IOException { channel.close(); } @Override public void flush() throws IOException { channel.flush(); } } } </code></pre> <p>If you have any questions, please feel free to ask.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload