@Override public void close() throws IOException { super.close(); destroy(); } };
private TemporaryBuffer doMerge(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( db != null ? nonNullRepo().getDirectory() : null, inCoreLimit); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), UTF_8); buf.close(); } catch (IOException e) { buf.destroy(); throw e; } return buf; }
@Override public void close() throws IOException { super.close(); destroy(); } };
/** * Run the LFS clean filter on the given stream and return a stream to the * LFS pointer file buffer. Used when inserting objects. * * @param db * the {@link Repository} * @param originalContent * the {@link InputStream} to the original content * @return a {@link TemporaryBuffer} representing the LFS pointer. The * caller is responsible to destroy the buffer. * @throws IOException * in case of any error. */ public static TemporaryBuffer cleanLfsBlob(Repository db, InputStream originalContent) throws IOException { LocalFile buffer = new TemporaryBuffer.LocalFile(null); CleanFilter f = new CleanFilter(db, originalContent, buffer); try { while (f.run() != -1) { // loop as long as f.run() tells there is work to do } } catch (IOException e) { buffer.destroy(); throw e; } return buffer; }
private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( db.getDirectory(), 10 << 20); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }
private TemporaryBuffer doMerge(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( db != null ? nonNullRepo().getDirectory() : null, inCoreLimit); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), UTF_8); buf.close(); } catch (IOException e) { buf.destroy(); throw e; } return buf; }