简体   繁体   English

将多个jpg文件与单个文件分开

[英]separate multiple jpg files from a single file

I have merged multiple jpeg files into one single .bin file. 我已经将多个jpeg文件合并为一个单个的.bin文件。

.....
.........
while(true){
             if (q.numOfFiles() > 0) {
              source = q.getNextFile();
              in = new DataInputStream(new BufferedInputStream(new FileInputStream(source)));
               byte[] buf = new byte[1024];
               int len;
               while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
               }
               String s = "filename=="+source.getName()+"==filename";
               out.write(s.getBytes());
               out.flush();
               System.out.println("merged--"+source.getName());
             }
                }
........
........

as you can see i am appending "filename=="+source.getName()+"==filename" after end of each file. 如您所见,我在每个文件末尾都附加了“ filename ==“ + source.getName()+” == filename“。 Now i want to separate all those jpegs with their actual file names. 现在,我想用其实际文件名将所有这些jpeg分开。 How can i read the separators that I've inserted in the merged files ? 如何阅读在合并文件中插入的分隔符?

As above in the comments: Sugestion/answer to adapt your point of view: 如上注释中所述:摘要/答案以适应您的观点:

Using a single file zip to ship multiple files. 使用单个文件zip发送多个文件。

How to create zip in Java 如何在Java中创建zip

And to extract: 并提取:

Extract from zip in Java 从Java中的zip提取

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM