public class TarFile extends Object implements Closeable
| Constructor and Description |
|---|
TarFile(byte[] content)
Constructor for TarFile.
|
TarFile(byte[] content,
boolean lenient)
Constructor for TarFile.
|
TarFile(byte[] content,
String encoding)
Constructor for TarFile.
|
TarFile(File archive)
Constructor for TarFile.
|
TarFile(File archive,
boolean lenient)
Constructor for TarFile.
|
TarFile(File archive,
String encoding)
Constructor for TarFile.
|
TarFile(Path archivePath)
Constructor for TarFile.
|
TarFile(Path archivePath,
boolean lenient)
Constructor for TarFile.
|
TarFile(Path archivePath,
String encoding)
Constructor for TarFile.
|
TarFile(SeekableByteChannel content)
Constructor for TarFile.
|
TarFile(SeekableByteChannel archive,
int blockSize,
int recordSize,
String encoding,
boolean lenient)
Constructor for TarFile.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
List<TarArchiveEntry> |
getEntries()
Get all TAR Archive Entries from the TarFile
|
InputStream |
getInputStream(TarArchiveEntry entry)
Gets the input stream for the provided Tar Archive Entry.
|
protected boolean |
isAtEOF() |
protected void |
setAtEOF(boolean b) |
public TarFile(byte[] content) throws IOException
content - the content to useIOException - when reading the tar archive failspublic TarFile(byte[] content, String encoding) throws IOException
content - the content to useencoding - the encoding to useIOException - when reading the tar archive failspublic TarFile(byte[] content, boolean lenient) throws IOException
content - the content to uselenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be
ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an
exception instead.IOException - when reading the tar archive failspublic TarFile(File archive) throws IOException
archive - the file of the archive to useIOException - when reading the tar archive failspublic TarFile(File archive, String encoding) throws IOException
archive - the file of the archive to useencoding - the encoding to useIOException - when reading the tar archive failspublic TarFile(File archive, boolean lenient) throws IOException
archive - the file of the archive to uselenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be
ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an
exception instead.IOException - when reading the tar archive failspublic TarFile(Path archivePath) throws IOException
archivePath - the path of the archive to useIOException - when reading the tar archive failspublic TarFile(Path archivePath, String encoding) throws IOException
archivePath - the path of the archive to useencoding - the encoding to useIOException - when reading the tar archive failspublic TarFile(Path archivePath, boolean lenient) throws IOException
archivePath - the path of the archive to uselenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be
ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an
exception instead.IOException - when reading the tar archive failspublic TarFile(SeekableByteChannel content) throws IOException
content - the content to useIOException - when reading the tar archive failspublic TarFile(SeekableByteChannel archive, int blockSize, int recordSize, String encoding, boolean lenient) throws IOException
archive - the seekable byte channel to useblockSize - the blocks size to userecordSize - the record size to useencoding - the encoding to uselenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be
ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an
exception instead.IOException - when reading the tar archive failspublic List<TarArchiveEntry> getEntries()
protected final boolean isAtEOF()
protected final void setAtEOF(boolean b)
public InputStream getInputStream(TarArchiveEntry entry) throws IOException
entry - Entry to get the input stream fromIOException - Corrupted TAR archive. Can't read entry.public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.