Package io.github.qishr.cascara.common.util
Class ArchiveFile
java.lang.Object
io.github.qishr.cascara.common.util.ArchiveFile
All Implemented Interfaces:
AutoCloseable
Direct Known Subtypes:
JarFile
public class ArchiveFile
Nested Class Summary
| Modifier and Type | Class | Description |
|---|---|---|
| public static | io.github.qishr.cascara.common.util.ArchiveFile.EntryInfo |
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
| protected Path | archivePath |
Constructor Summary
| Constructor | Description |
|---|---|
| ArchiveFile(Path archivePath, boolean create) |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public static ArchiveFile | open(Path archivePath) | |
| public static ArchiveFile | create(Path archivePath) | |
| public void | close() | |
| public InputStream | getInputStream(String filePath) | |
| public byte[] | extractFile(String filePath) | |
| protected static byte[] | extractFile(Path archivePath, String filePath) | |
| public List<EntryInfo> | listFiles() | |
| public List<EntryInfo> | listFiles(String dirPath) | |
| public void | addDirectory(Path dirPath) | |
| public void | addDirectory(Path sourcePath, String entryName) | |
| protected void | walk(Path sourcePath, String entryName, List<LocalizableIOException> exceptions, BiConsumer<Path, Path> run) | |
| public void | addFile(Path sourcePath, String entryName) | |
| public void | addFile(String content, String entryName) | |
| protected static List<EntryInfo> | listFiles(Path archivePath, String dirPath) |
Field Details
archivePath
protected Path archivePath
Method Details
open
public static ArchiveFile open(Path archivePath)
Throws:
create
public static ArchiveFile create(Path archivePath)
Throws:
close
public void close()
Throws:
Specified By:
getInputStream
public InputStream getInputStream(String filePath)
Throws:
extractFile
public byte[] extractFile(String filePath)
Throws:
extractFile
protected static byte[] extractFile(Path archivePath, String filePath)
Throws:
listFiles
public List<EntryInfo> listFiles()
Throws:
listFiles
public List<EntryInfo> listFiles(String dirPath)
Throws:
addDirectory
public void addDirectory(Path dirPath)
Throws:
addDirectory
public void addDirectory(Path sourcePath, String entryName)
Throws:
walk
protected void walk(Path sourcePath, String entryName, List<LocalizableIOException> exceptions, BiConsumer<Path, Path> run)
Throws:
addFile
public void addFile(Path sourcePath, String entryName)
Throws:
addFile
public void addFile(String content, String entryName)
Throws:
listFiles
protected static List<EntryInfo> listFiles(Path archivePath, String dirPath)
Throws: