org.apache.jackrabbit.oak.api.Root.getBlob()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.apache.jackrabbit.oak.api.Root.getBlob方法的一些代码示例,展示了Root.getBlob的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Root.getBlob方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Root
类名称:Root
方法名:getBlob

Root.getBlob介绍

[英]Get a blob by its reference.
[中]通过其引用获取一个blob。

代码示例

代码示例来源:origin: apache/jackrabbit-oak

@Nullable
@Override
public Blob getBlob(@NotNull String reference) {
  return base.getBlob(reference);
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
@NotNull
public Value createValue(@NotNull Binary value) {
  try {
    if (value instanceof BinaryImpl) {
      // No need to create the value again if we have it already underlying the binary
      return ((BinaryImpl) value).getBinaryValue();
    } else if (value instanceof ReferenceBinary) {
      String reference = ((ReferenceBinary) value).getReference();
      Blob blob = root.getBlob(reference);
      if (blob != null) {
        return createBinaryValue(blob);
      }
    }
    InputStream stream = value.getStream();
    if (stream == null) {
      throw new ValueFormatException("null");
    }
    return createBinaryValue(stream);
  } catch (RepositoryException e) {
    return new ErrorValue(e, PropertyType.BINARY);
  } catch (IOException e) {
    return new ErrorValue(e, PropertyType.BINARY);
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public Value createValue(Binary value) {
  try {
    if (value instanceof BinaryImpl) {
      // No need to create the value again if we have it already underlying the binary
      return ((BinaryImpl) value).getBinaryValue();
    } else if (value instanceof ReferenceBinary) {
      String reference = ((ReferenceBinary) value).getReference();
      Blob blob = root.getBlob(reference);
      if (blob != null) {
        return createBinaryValue(blob);
      }
    }
    return createBinaryValue(value.getStream());
  } catch (RepositoryException e) {
    return new ErrorValue(e, PropertyType.BINARY);
  } catch (IOException e) {
    return new ErrorValue(e, PropertyType.BINARY);
  }
}

相关文章