* Writes the contents to a stream.
*/
@Override
public void writeBlobToStream(String blobHash, OutputStream os)
{
GitObjectStream is = null;
try {
is = _git.open(blobHash);
if (is.getType() != GitType.BLOB)
throw new RepositoryException(L.l("'{0}' is an unexpected type, expected 'blob'",
is.getType()));
WriteStream out = null;
if (os instanceof WriteStream)
out = (WriteStream) os;
else
out = Vfs.openWrite(os);
try {
out.writeStream(is.getInputStream());
} finally {
if (out != null && out != os)
out.close();
}
} catch (IOException e) {
throw new RepositoryException(e);
} finally {
is.close();
}
}