public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { // make the included archive formats known ArchiveFormats.registerAll(); try { write(repository, ".zip", "zip"); write(repository, ".tar.gz", "tgz"); write(repository, ".tar.bz2", "tbz2"); write(repository, ".tar.xz", "txz"); } finally { ArchiveFormats.unregisterAll(); } } }
/** * Register all included archive formats so they can be used * as arguments to the ArchiveCommand.setFormat() method. * * Not thread-safe. */ public static void registerAll() { register("tar", new TarFormat()); //$NON-NLS-1$ register("tgz", new TgzFormat()); //$NON-NLS-1$ register("tbz2", new Tbz2Format()); //$NON-NLS-1$ register("txz", new TxzFormat()); //$NON-NLS-1$ register("zip", new ZipFormat()); //$NON-NLS-1$ }
/** * Cleans up after {@link #start(BundleContext)} by calling * {@link ArchiveFormats#unregisterAll}. * * @param context * unused */ public void stop(BundleContext context) { ArchiveFormats.unregisterAll(); } }
@Override public void writeData(Attributes attributes) throws IOException { if (format.equals("zip")) ArchiveCommand.registerFormat(format, new ZipFormat()); else ArchiveCommand.registerFormat(format, new TgzFormat()); try { ArchiveCommand archive = Git.wrap(project.getRepository()).archive(); archive.setFormat(format); archive.setTree(project.getRevCommit(revision).getId()); archive.setOutputStream(attributes.getResponse().getOutputStream()); archive.call(); } catch (GitAPIException e) { throw new RuntimeException(e); } finally { ArchiveCommand.unregisterFormat(format); } } });
/** * Registers all included archive formats by calling * {@link ArchiveFormats#registerAll()}. This method is called by the OSGi * framework when the bundle is started. * * @param context * unused */ public void start(BundleContext context) { ArchiveFormats.registerAll(); }
public ArchiveOutputStream createArchiveOutputStream(OutputStream s) throws IOException { return createArchiveOutputStream(s, Collections.<String, Object> emptyMap()); }
public ArchiveOutputStream createArchiveOutputStream(OutputStream s) throws IOException { return createArchiveOutputStream(s, Collections.<String, Object> emptyMap()); }
public ArchiveOutputStream createArchiveOutputStream(OutputStream s) throws IOException { return createArchiveOutputStream(s, Collections.<String, Object> emptyMap()); }
public ArchiveOutputStream createArchiveOutputStream(OutputStream s) throws IOException { return createArchiveOutputStream(s, Collections.<String, Object> emptyMap()); }
public ArchiveOutputStream createArchiveOutputStream(OutputStream s) throws IOException { return createArchiveOutputStream(s, Collections.<String, Object> emptyMap()); }
/** * @since 4.0 */ public ArchiveOutputStream createArchiveOutputStream(OutputStream s, Map<String, Object> o) throws IOException { return applyFormatOptions(new ZipArchiveOutputStream(s), o); }
/** * @since 4.0 */ public ArchiveOutputStream createArchiveOutputStream(OutputStream s, Map<String, Object> o) throws IOException { TarArchiveOutputStream out = new TarArchiveOutputStream(s, "UTF-8"); //$NON-NLS-1$ out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); out.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX); return applyFormatOptions(out, o); }
/** * Register all included archive formats so they can be used * as arguments to the ArchiveCommand.setFormat() method. * * Not thread-safe. */ public static void registerAll() { register("tar", new TarFormat()); //$NON-NLS-1$ register("tgz", new TgzFormat()); //$NON-NLS-1$ register("tbz2", new Tbz2Format()); //$NON-NLS-1$ register("txz", new TxzFormat()); //$NON-NLS-1$ register("zip", new ZipFormat()); //$NON-NLS-1$ }
public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { // make the included archive formats known ArchiveFormats.registerAll(); try { write(repository, ".zip", "zip"); write(repository, ".tar.gz", "tgz"); write(repository, ".tar.bz2", "tbz2"); write(repository, ".tar.xz", "txz"); } finally { ArchiveFormats.unregisterAll(); } } }
/** * Cleans up after {@link #start(BundleContext)} by calling * {@link ArchiveFormats#unregisterAll}. * * @param context * unused */ public void stop(BundleContext context) { ArchiveFormats.unregisterAll(); } }
/** * Registers all included archive formats by calling * {@link ArchiveFormats#registerAll()}. This method is called by the OSGi * framework when the bundle is started. * * @param context * unused */ public void start(BundleContext context) { ArchiveFormats.registerAll(); }