List of usage examples for org.eclipse.jgit.util.io AutoCRLFOutputStream AutoCRLFOutputStream
public AutoCRLFOutputStream(OutputStream out)
Constructor for AutoCRLFOutputStream.
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(); }