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

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

Introduction

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

Prototype

public InputStream openInputStream() throws IOException 

Source Link

Document

Open an input stream to read from the buffered data.

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 ww  w . jav  a  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();
    }
}