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

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

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

Root.createBlob介绍

[英]Reads (and closes) the given stream and returns a Blob that contains that binary. The returned blob will remain valid at least until the ContentSession of this root is closed, or longer if it has been committed as a part of a content update.

The implementation may decide to persist the blob at any point during or between this method method call and a #commit()that includes the blob, but the blob will become visible to other sessions only after such a commit.
[中]读取(并关闭)给定流并返回包含该二进制文件的Blob。返回的blob将保持有效,至少在该根目录的ContentSession关闭之前有效,如果它已作为内容更新的一部分提交,则会保持更长时间。
实现可能会决定在该方法调用和包含该blob的#commit()之间的任何时间点持久化该blob,但只有在该提交之后,该blob才会对其他会话可见。

代码示例

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

private Blob getBlob(Root root, Supplier<InputStream> supplier) {
  InputStream inputStream = supplier.get();
  if (inputStream == null) {
    throw new IllegalStateException("invalid input stream");
  }
  Blob blob;
  try {
    blob = root.createBlob(inputStream);
  } catch (Exception e) {
    throw new IllegalStateException("unable to create a blob", e);
  }
  return blob;
}

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

@NotNull
@Override
public Blob createBlob(@NotNull InputStream stream) throws IOException {
  return base.createBlob(stream);
}

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

@Override
public ContentRemoteBinaryId writeBinary(InputStream stream) {
  if (stream == null) {
    throw new IllegalArgumentException("stream not provided");
  }
  Blob blob;
  try {
    blob = contentSession.getLatestRoot().createBlob(stream);
  } catch (IOException e) {
    throw new RuntimeException("unable to write the binary object", e);
  }
  return new ContentRemoteBinaryId(contentRemoteBinaries.put(blob), blob);
}

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

@NotNull
private ValueImpl createBinaryValue(@NotNull InputStream value) throws IOException, RepositoryException {
  long start = binOpsLogger.start();
  Blob blob = root.createBlob(value);
  binOpsLogger.end(start, -1, "Created binary property of size [{}]", blob.length());
  return createBinaryValue(blob);
}

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

private ValueImpl createBinaryValue(InputStream value) throws IOException, RepositoryException {
  long start = binOpsLogger.start();
  Blob blob = root.createBlob(value);
  binOpsLogger.end(start, -1, "Created binary property of size [{}]", blob.length());
  return createBinaryValue(blob);
}

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

assertEquals(values, actual);
Blob blob = root.createBlob(new ByteArrayInputStream(bytes));
String name = split[0];
Tree child = test.addChild(name);

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

assertEquals(values, actual);
Blob blob = root.createBlob(new ByteArrayInputStream(bytes));
String name = split[0];
Tree child = test.addChild(name);

相关文章