Tabnine Logo
Archive
Code IndexAdd Tabnine to your IDE (free)

How to use
Archive
in
de.innosystec.unrar

Best Java code snippets using de.innosystec.unrar.Archive (Showing top 11 results out of 315)

origin: com.atlassian.addon.connect.hercules/hercules-ac

public RarStream(final File file, final Executor executor) throws Exception
{
  rarArchive = new Archive(file);
  this.executor = executor;
}
origin: com.atlassian.addon.connect.hercules/hercules-ac

@Override
public void close() throws IOException
{
  rarArchive.close();
}
origin: com.github.axet/java-unrar

Archive a=null;
try {
  a = new Archive(new NativeStorage(f));
} catch (RarException e) {
  a.getMainHeader().print();
  FileHeader fh = a.nextFileHeader();
  while(fh!=null){	
    try {
      System.out.println(out.getAbsolutePath());
      FileOutputStream os = new FileOutputStream(out);
      a.extractFile(fh, os);
      os.close();
    } catch (FileNotFoundException e) {
    fh=a.nextFileHeader();
origin: StannyBing/ZXUtils

  return;
Archive rarFile = new Archive(new NativeStorage(new File(rarFilePath)));
de.innosystec.unrar.rarfile.FileHeader fileHeader = null;
final int total = rarFile.getFileHeaders().size();
int progressNow = -1;
for (int i = 0; i < rarFile.getFileHeaders().size(); i++) {
  fileHeader = rarFile.getFileHeaders().get(i);
  String entrypath = "";
  if (fileHeader.isUnicode()) {//解决中文乱码
    rarFile.extractFile(fileHeader, fileOut);
    fileOut.close();
origin: com.github.axet/java-unrar

public static boolean mergeArchive(Archive archive, ComprDataIO dataIO)
    throws IOException {
  FileHeader hd = dataIO.getSubHeader();
  if (hd.getUnpVersion()>=20 &&
      hd.getFileCRC()!=0xffffffff &&
      dataIO.getPackedCRC()!=~hd.getFileCRC()) {
    System.err.println("Data Bad CRC");
  }
  boolean oldNumbering = !archive.getMainHeader().isNewNumbering() ||
      archive.isOldFormat();
  String nextName = nextVolumeName(archive.getFile().getPath(),
      oldNumbering);
  NativeStorage nextVolume = archive.getFile().getParent().open(nextName);
  UnrarCallback callback = archive.getUnrarCallback();
  if ((callback != null) && !callback.isNextVolumeReady(nextVolume)) {
    return false;
  }
  if (!nextVolume.exists()) {
    return false;
  }
  archive.setFile(nextVolume);
  hd = archive.nextFileHeader();
  if (hd == null) {
    return false;
  }
  dataIO.init(hd);
  return true;
}
origin: com.github.axet/java-unrar

public void parse(
    InputStream stream, ContentHandler handler,
    Metadata metadata, ParseContext context)
    throws SAXException, IOException, TikaException {
  EmbeddedDocumentExtractor extractor =
    new EmbeddedDocumentExtractor(context);
  try {
    File file = TikaInputStream.get(stream).getFile();
    Archive archive = new Archive(new NativeStorage(file));
    metadata.set(Metadata.CONTENT_TYPE, TYPE.toString());
    XHTMLContentHandler xhtml =
      new XHTMLContentHandler(handler, metadata);
    xhtml.startDocument();
    for (FileHeader header : archive.getFileHeaders()) {
      Metadata entrydata = new Metadata();
      entrydata.set(
          Metadata.RESOURCE_NAME_KEY,
          header.getFileNameString());
      if (extractor.shouldParseEmbedded(entrydata)) {
        extractor.parseEmbedded(stream, xhtml, entrydata, true);
      }
    }
    xhtml.endDocument();
  } catch (RarException e) {
    throw new TikaException("Unable to parse a RAR archive", e);
  }
}
origin: com.atlassian.addon.connect.hercules/hercules-ac

  @Override
  public void run()
  {
    try
    {
      latch.countDown();
      rarArchive.extractFile(header, pOut);
    }
    catch (final RarException e)
    {
      LOGGER.error("Unknown exception:", e);
    }
    finally
    {
      try
      {
        pOut.close();
      }
      catch (final IOException e)
      {
        LOGGER.warn("Unknown exception closing reader.", e);
      }
    }
  }
}
origin: com.github.axet/java-unrar

void setFile(NativeStorage file) throws IOException {
this.file = file;
totalPackedSize = 0L;
totalPackedRead = 0L;
close();
rof =file.read();
try {
  readHeaders();
} catch (Exception e) {
  logger.log(Level.WARNING,
    "exception in archive constructor maybe file is encrypted "
      + "or currupt", e);
  // ignore exceptions to allow exraction of working files in
  // corrupt archive
}
// Calculate size of packed data
for (BaseBlock block : headers) {
  if (block.getHeaderType() == UnrarHeadertype.FileHeader) {
  totalPackedSize += ((FileHeader) block).getFullPackSize();
  }
}
if (unrarCallback != null) {
  unrarCallback.volumeProgressChanged(totalPackedRead,
    totalPackedSize);
}
}
origin: com.atlassian.addon.connect.hercules/hercules-ac

@Override
public ArchiveEntry getNextEntry(boolean calculateSize)
{
  header = rarArchive.nextFileHeader();
  if (header == null)
  { return null; }
  return new DefaultArchiveEntry(header.getFileNameString(), header.getFullUnpackSize(), header.getMTime().getTime());
}
origin: com.github.axet/java-unrar

/**
 * Extract the file specified by the given header and write it to the
 * supplied output stream
 * 
 * @param header
 *            the header to be extracted
 * @param os
 *            the outputstream
 * @throws RarException
 */
public void extractFile(FileHeader hd, OutputStream os) throws RarException {
if (!headers.contains(hd)) {
  throw new RarException(RarExceptionType.headerNotInArchive);
}
try {
  doExtractFile(hd, os);
} catch (Exception e) {
  if (e instanceof RarException) {
  throw (RarException) e;
  } else {
  throw new RarException(e);
  }
}
}
origin: com.github.axet/java-unrar

count -= retCode;
unpPackedSize -= retCode;
archive.bytesReadRead(retCode);
if (unpPackedSize == 0 && subHead.isSplitAfter()) {
  if (!Volume.mergeArchive(archive, this)) {
de.innosystec.unrarArchive

Javadoc

The Main Rar Class; represents a rar Archive

Most used methods

  • <init>
  • extractFile
    Extract the file specified by the given header and write it to the supplied output stream
  • close
    Close the underlying compressed file.
  • getFileHeaders
  • nextFileHeader
  • bytesReadRead
  • doExtractFile
  • getFile
  • getMainHeader
  • getRof
  • getUnrarCallback
  • isOldFormat
  • getUnrarCallback,
  • isOldFormat,
  • readHeaders,
  • setFile

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now