Package org.eclipse.jgit.api
Interface ArchiveCommand.Format<T extends Closeable>
-
- Type Parameters:
T
- type representing an archive being created.
- All Known Implementing Classes:
TarFormat
,Tbz2Format
,TgzFormat
,TxzFormat
,ZipFormat
- Enclosing class:
- ArchiveCommand
public static interface ArchiveCommand.Format<T extends Closeable>
Archival format. Usage: Repository repo = git.getRepository(); T out = format.createArchiveOutputStream(System.out); try { for (...) { format.putEntry(out, path, mode, repo.open(objectId)); } out.close(); }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
createArchiveOutputStream(OutputStream s)
Start a new archive.T
createArchiveOutputStream(OutputStream s, Map<String,Object> o)
Start a new archive.void
putEntry(T out, ObjectId tree, String path, FileMode mode, ObjectLoader loader)
Write an entry to an archive.Iterable<String>
suffixes()
Filename suffixes representing this format (e.g., { ".tar.gz", ".tgz" }).
-
-
-
Method Detail
-
createArchiveOutputStream
T createArchiveOutputStream(OutputStream s) throws IOException
Start a new archive. Entries can be included in the archive using the putEntry method, and then the archive should be closed using its close method.- Parameters:
s
- underlying output stream to which to write the archive.- Returns:
- new archive object for use in putEntry
- Throws:
IOException
- thrown by the underlying output stream for I/O errors
-
createArchiveOutputStream
T createArchiveOutputStream(OutputStream s, Map<String,Object> o) throws IOException
Start a new archive. Entries can be included in the archive using the putEntry method, and then the archive should be closed using its close method. In addition options can be applied to the underlying stream. E.g. compression level.- Parameters:
s
- underlying output stream to which to write the archive.o
- options to apply to the underlying output stream. Keys are option names and values are option values.- Returns:
- new archive object for use in putEntry
- Throws:
IOException
- thrown by the underlying output stream for I/O errors- Since:
- 4.0
-
putEntry
void putEntry(T out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException
Write an entry to an archive.- Parameters:
out
- archive object from createArchiveOutputStreamtree
- the tag, commit, or tree object to produce an archive forpath
- full filename relative to the root of the archive (with trailing '/' for directories)mode
- mode (for example FileMode.REGULAR_FILE or FileMode.SYMLINK)loader
- blob object with data for this entry (null for directories)- Throws:
IOException
- thrown by the underlying output stream for I/O errors- Since:
- 4.7
-
-