Module org.hsqldb

Class TarReader

java.lang.Object
org.hsqldb.lib.tar.TarReader

public class TarReader extends Object
Reads a Tar file for reporting or extraction. N.b. this is not a Reader in the java.io.Reader sense, but in the sense of differentiating tar x and tar t from tar c.

SECURITY NOTE Due to pitiful lack of support for file security in Java before version 1.6, this class will only explicitly set permissions if it is compiled for Java 1.6. If it was not, and if your tar entries contain private data in files with 0400 or similar, be aware that they will be extracted with privs such that they can be ready by anybody.

Author:
Blaine Simpson (blaine dot simpson at admc dot com)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    EXTRACT_MODE refuses to overwrite existing files.
    static final int
     
    static final int
    OVERWRITE_MODE is just EXTRACT_MODE where we will silently overwrite existing files upon extraction.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TarReader(File inFile, int mode, String[] patternStrings, Integer readBufferBlocks, File inDir)
    Compression is determined directly by the suffix of the file name in the specified path.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LIST_MODE

      public static final int LIST_MODE
      See Also:
    • EXTRACT_MODE

      public static final int EXTRACT_MODE
      EXTRACT_MODE refuses to overwrite existing files.
      See Also:
    • OVERWRITE_MODE

      public static final int OVERWRITE_MODE
      OVERWRITE_MODE is just EXTRACT_MODE where we will silently overwrite existing files upon extraction.
      See Also:
  • Constructor Details

    • TarReader

      public TarReader(File inFile, int mode, String[] patternStrings, Integer readBufferBlocks, File inDir) throws IOException
      Compression is determined directly by the suffix of the file name in the specified path.
      Parameters:
      inFile - Absolute or relative (from user.dir) path to tar file to be read. Suffix may indicate a compression method.
      mode - Whether to list, extract-without-overwrite, or extract-with-overwrite.
      patternStrings - List of regular expressions to match against tar entry names. If null, all entries will be listed or extracted. If non-null, then only entries with names which match will be extracted or listed.
      readBufferBlocks - Null will use default tar value.
      inDir - Directory that RELATIVE entries will be extracted relative to. Defaults to current directory (user.dir). Only used for extract modes and relative file entries.
      Throws:
      IOException - on access failure
      IllegalArgumentException - if any given pattern is an invalid regular expression. Don't have to worry about this if you call with null 'patterns' param.
      See Also:
  • Method Details