/** * Create an index file to match the pack file just written. * <p> * Called after * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. * <p> * Writing an index is only required for local pack storage. Packs sent on * the network do not need to create an index. * * @param indexStream * output for the index data. Caller is responsible for closing * this stream. * @throws java.io.IOException * the index data could not be written to the supplied stream. */ public void writeIndex(OutputStream indexStream) throws IOException { if (isIndexDisabled()) throw new IOException(JGitText.get().cachedPacksPreventsIndexCreation); long writeStart = System.currentTimeMillis(); final PackIndexWriter iw = PackIndexWriter.createVersion( indexStream, getIndexVersion()); iw.write(sortByName(), packcsum); stats.timeWriting += System.currentTimeMillis() - writeStart; }
private static void writeIndex(DfsObjDatabase objdb, DfsPackDescription pack, PackWriter pw) throws IOException { try (DfsOutputStream out = objdb.writeFile(pack, INDEX)) { CountingOutputStream cnt = new CountingOutputStream(out); pw.writeIndex(cnt); pack.addFileExt(INDEX); pack.setFileSize(INDEX, cnt.getCount()); pack.setBlockSize(INDEX, out.blockSize()); pack.setIndexVersion(pw.getIndexVersion()); } }
pack.setFileSize(INDEX, cnt.getCount()); pack.setBlockSize(INDEX, out.blockSize()); pack.setIndexVersion(pw.getIndexVersion());
/** * Create an index file to match the pack file just written. * <p> * Called after * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. * <p> * Writing an index is only required for local pack storage. Packs sent on * the network do not need to create an index. * * @param indexStream * output for the index data. Caller is responsible for closing * this stream. * @throws java.io.IOException * the index data could not be written to the supplied stream. */ public void writeIndex(OutputStream indexStream) throws IOException { if (isIndexDisabled()) throw new IOException(JGitText.get().cachedPacksPreventsIndexCreation); long writeStart = System.currentTimeMillis(); final PackIndexWriter iw = PackIndexWriter.createVersion( indexStream, getIndexVersion()); iw.write(sortByName(), packcsum); stats.timeWriting += System.currentTimeMillis() - writeStart; }
/** * Create an index file to match the pack file just written. * <p> * Called after * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. * <p> * Writing an index is only required for local pack storage. Packs sent on * the network do not need to create an index. * * @param indexStream * output for the index data. Caller is responsible for closing * this stream. * @throws IOException * the index data could not be written to the supplied stream. */ public void writeIndex(final OutputStream indexStream) throws IOException { if (isIndexDisabled()) throw new IOException(JGitText.get().cachedPacksPreventsIndexCreation); long writeStart = System.currentTimeMillis(); final PackIndexWriter iw = PackIndexWriter.createVersion( indexStream, getIndexVersion()); iw.write(sortByName(), packcsum); stats.timeWriting += System.currentTimeMillis() - writeStart; }
private static void writeIndex(DfsObjDatabase objdb, DfsPackDescription pack, PackWriter pw) throws IOException { DfsOutputStream out = objdb.writeFile(pack, INDEX); try { CountingOutputStream cnt = new CountingOutputStream(out); pw.writeIndex(cnt); pack.addFileExt(INDEX); pack.setFileSize(INDEX, cnt.getCount()); pack.setIndexVersion(pw.getIndexVersion()); } finally { out.close(); } }
private static void writeIndex(DfsObjDatabase objdb, DfsPackDescription pack, PackWriter pw) throws IOException { try (DfsOutputStream out = objdb.writeFile(pack, INDEX)) { CountingOutputStream cnt = new CountingOutputStream(out); pw.writeIndex(cnt); pack.addFileExt(INDEX); pack.setFileSize(INDEX, cnt.getCount()); pack.setBlockSize(INDEX, out.blockSize()); pack.setIndexVersion(pw.getIndexVersion()); } }
pack.addFileExt(INDEX); pack.setFileSize(INDEX, cnt.getCount()); pack.setIndexVersion(pw.getIndexVersion());
pack.setFileSize(INDEX, cnt.getCount()); pack.setBlockSize(INDEX, out.blockSize()); pack.setIndexVersion(pw.getIndexVersion());