Example usage for org.eclipse.jgit.util TemporaryBuffer.LocalFile close

List of usage examples for org.eclipse.jgit.util TemporaryBuffer.LocalFile close

Introduction

In this page you can find the example usage for org.eclipse.jgit.util TemporaryBuffer.LocalFile close.

Prototype

@Override
public void close() throws IOException 

Source Link

Usage

From source file:com.itemis.maven.plugins.unleash.scm.providers.merge.UnleashGitMerger.java

License:Eclipse Distribution License

private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException {
    TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile(this.db.getDirectory(), 10 << 20);
    try {/*from   w w w.  java 2  s .  c o  m*/
        new MergeFormatter().formatMerge(buf, result, Arrays.asList(this.commitNames), CHARACTER_ENCODING);
        buf.close();
        InputStream in = null;
        try {
            in = buf.openInputStream();
            return getObjectInserter().insert(OBJ_BLOB, buf.length(), in);
        } finally {
            Closeables.closeQuietly(in);
        }
    } finally {
        buf.destroy();
    }
}