use of org.eclipse.jgit.util.io.AutoCRLFInputStream in project egit by eclipse.
the class GitBlobStorage method open.
private InputStream open() throws IOException, CoreException, IncorrectObjectTypeException {
if (blobId == null)
return new ByteArrayInputStream(new byte[0]);
try {
WorkingTreeOptions workingTreeOptions = db.getConfig().get(WorkingTreeOptions.KEY);
final InputStream objectInputStream = db.open(blobId, Constants.OBJ_BLOB).openStream();
switch(workingTreeOptions.getAutoCRLF()) {
case INPUT:
// itself should ignore line endings.
case FALSE:
return objectInputStream;
case TRUE:
default:
return new AutoCRLFInputStream(objectInputStream, true);
}
} catch (MissingObjectException notFound) {
throw new CoreException(Activator.error(NLS.bind(CoreText.BlobStorage_blobNotFound, blobId.name(), path), notFound));
}
}
Aggregations