From 124f869faae3a0f75a3825e6a8e195c17f3c626a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 16 Oct 2014 23:34:20 +0400 Subject: initial for idea --- .../src/main/java/com/github/junrar/MVTest.java | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 org.fox.ttcomics/src/main/java/com/github/junrar/MVTest.java (limited to 'org.fox.ttcomics/src/main/java/com/github/junrar/MVTest.java') diff --git a/org.fox.ttcomics/src/main/java/com/github/junrar/MVTest.java b/org.fox.ttcomics/src/main/java/com/github/junrar/MVTest.java new file mode 100644 index 0000000..36c33c8 --- /dev/null +++ b/org.fox.ttcomics/src/main/java/com/github/junrar/MVTest.java @@ -0,0 +1,56 @@ +package com.github.junrar; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import com.github.junrar.exception.RarException; +import com.github.junrar.impl.FileVolumeManager; +import com.github.junrar.rarfile.FileHeader; + + +public class MVTest { + + /** + * @param args + */ + public static void main(String[] args) { + String filename = "/home/rogiel/fs/home/ae721273-eade-45e7-8112-d14115ebae56/Village People - Y.M.C.A.mp3.part1.rar"; + File f = new File(filename); + Archive a = null; + try { + a = new Archive(new FileVolumeManager(f)); + } catch (RarException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (a != null) { + a.getMainHeader().print(); + FileHeader fh = a.nextFileHeader(); + while (fh != null) { + try { + File out = new File("/home/rogiel/fs/test/" + + fh.getFileNameString().trim()); + System.out.println(out.getAbsolutePath()); + FileOutputStream os = new FileOutputStream(out); + a.extractFile(fh, os); + os.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (RarException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + fh = a.nextFileHeader(); + } + } + } +} -- cgit v1.2.3