Package org.eclipse.jgit.api
Interface ArchiveCommand.Format<T extends java.io.Closeable>
-
- Type Parameters:
T
- type representing an archive being created.
- Enclosing class:
- ArchiveCommand
public static interface ArchiveCommand.Format<T extends java.io.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(java.io.OutputStream s)
Start a new archive.void
putEntry(T out, java.lang.String path, FileMode mode, ObjectLoader loader)
Write an entry to an archive.java.lang.Iterable<java.lang.String>
suffixes()
Filename suffixes representing this format (e.g., { ".tar.gz", ".tgz" }).
-
-
-
Method Detail
-
createArchiveOutputStream
T createArchiveOutputStream(java.io.OutputStream s) throws java.io.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:
java.io.IOException
- thrown by the underlying output stream for I/O errors
-
putEntry
void putEntry(T out, java.lang.String path, FileMode mode, ObjectLoader loader) throws java.io.IOException
Write an entry to an archive.- Parameters:
out
- archive object from createArchiveOutputStreampath
- 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:
java.io.IOException
- thrown by the underlying output stream for I/O errors
-
suffixes
java.lang.Iterable<java.lang.String> suffixes()
Filename suffixes representing this format (e.g., { ".tar.gz", ".tgz" }). The behavior is undefined when suffixes overlap (if one format claims suffix ".7z", no other format should take ".tar.7z").- Returns:
- this format's suffixes
-
-