Example usage for org.eclipse.jgit.util.io AutoCRLFOutputStream AutoCRLFOutputStream

List of usage examples for org.eclipse.jgit.util.io AutoCRLFOutputStream AutoCRLFOutputStream

Introduction

In this page you can find the example usage for org.eclipse.jgit.util.io AutoCRLFOutputStream AutoCRLFOutputStream.

Prototype

public AutoCRLFOutputStream(OutputStream out) 

Source Link

Document

Constructor for AutoCRLFOutputStream.

Usage

From source file:jetbrains.buildServer.buildTriggers.vcs.git.GitVcsFileContentProvider.java

License:Apache License

/**
 * Load object by blob ID//  w  w w. j ava 2  s.  c  o m
 *
 * @param r    the repository
 * @param path the path (might be null)
 * @param id   the object id
 * @return the object's bytes
 * @throws IOException in case of IO problem
 */
private byte[] loadObject(@NotNull GitVcsRoot root, Repository r, String path, ObjectId id) throws IOException {
    final ObjectLoader loader = r.open(id);
    if (loader == null) {
        throw new IOException(
                "Unable to find blob " + id + (path == null ? "" : "(" + path + ")") + " in repository " + r);
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream((int) loader.getSize());
    OutputStream output = root.isAutoCrlf() ? new AutoCRLFOutputStream(out) : out;
    loader.copyTo(output);
    output.flush();
    return out.toByteArray();
}