Example usage for org.eclipse.jgit.util TemporaryBuffer.Heap length

List of usage examples for org.eclipse.jgit.util TemporaryBuffer.Heap length

Introduction

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

Prototype

public long length() 

Source Link

Document

Obtain the length (in bytes) of the buffer.

Usage

From source file:com.google.gerrit.httpd.restapi.RestApiServlet.java

License:Apache License

@SuppressWarnings("resource")
private static BinaryResult asBinaryResult(final TemporaryBuffer.Heap buf) {
    return new BinaryResult() {
        @Override//from w  w w . ja  v  a 2  s .  com
        public void writeTo(OutputStream os) throws IOException {
            buf.writeTo(os, null);
        }
    }.setContentLength(buf.length());
}