本文整理了Java中org.apache.jackrabbit.oak.spi.blob.BlobStore.writeBlob()
方法的一些代码示例,展示了BlobStore.writeBlob()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.writeBlob()
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.spi.blob.BlobStore
类名称:BlobStore
方法名:writeBlob
[英]Write a blob from an input stream. This method closes the input stream.
[中]从输入流写入blob。此方法关闭输入流。
代码示例来源:origin: apache/jackrabbit-oak
@Override
public String writeBlob(InputStream in) throws IOException {
String blobId = newBlobStore.writeBlob(in);
migratedBlobs.add(blobId);
return blobId;
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
@NotNull
public BlobStoreBlob createBlob(InputStream inputStream) throws IOException {
return new BlobStoreBlob(blobStore, blobStore.writeBlob(inputStream));
}
代码示例来源:origin: org.apache.jackrabbit/oak-store-document
@Override
@NotNull
public BlobStoreBlob createBlob(InputStream inputStream) throws IOException {
return new BlobStoreBlob(blobStore, blobStore.writeBlob(inputStream));
}
代码示例来源:origin: apache/jackrabbit-oak
private void writeBlob(String blobId, InputStream stream) {
try {
blobStore.writeBlob(stream);
} catch (IOException e) {
throw new BlobWriteException(blobId, e);
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
public String writeBlob(InputStream in) throws IOException {
String blobId = newBlobStore.writeBlob(in);
migratedBlobs.add(blobId);
return blobId;
}
代码示例来源:origin: org.apache.jackrabbit/oak-blob
@Override
public String writeBlob(InputStream in) throws IOException {
String blobId = newBlobStore.writeBlob(in);
migratedBlobs.add(blobId);
return blobId;
}
代码示例来源:origin: apache/jackrabbit-oak
static BlobFactory getBlobStoreBlobFactory(final BlobStore store) {
return in -> {
String blobId;
if (!ENABLE_ASYNC_DS) {
blobId = store.writeBlob(in, new BlobOptions().setUpload(SYNCHRONOUS));
} else {
blobId = store.writeBlob(in);
}
return new BlobStoreBlob(store, blobId);
};
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-lucene
static BlobFactory getBlobStoreBlobFactory(final BlobStore store) {
return in -> {
String blobId;
if (!ENABLE_ASYNC_DS) {
blobId = store.writeBlob(in, new BlobOptions().setUpload(SYNCHRONOUS));
} else {
blobId = store.writeBlob(in);
}
return new BlobStoreBlob(store, blobId);
};
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk
public String write(InputStream in) throws MicroKernelException {
if (rep == null) {
throw new IllegalStateException("this instance has already been disposed");
}
try {
return rep.getBlobStore().writeBlob(in);
} catch (Exception e) {
throw new MicroKernelException(e);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-tarmk-standby
private void readBlob(String blobId, String pName) {
Blob read = loader.readBlob(blobId);
if (read != null) {
try {
store.getBlobStore().writeBlob(read.getNewStream());
} catch (IOException f) {
throw new IllegalStateException("Unable to persist blob "
+ blobId + " at " + path + "#" + pName, f);
}
} else {
throw new IllegalStateException("Unable to load remote blob "
+ blobId + " at " + path + "#" + pName);
}
}
代码示例来源:origin: apache/jackrabbit-oak
private List<String> addBlobs(BlobStore blobStore) throws IOException {
List<String> ids = new ArrayList<String>();
for (int i = 0; i < 5; i++) {
byte[] buffer = new byte[LENGTH];
random.nextBytes(buffer);
InputStream bis = new ByteArrayInputStream(buffer);
ids.add(blobStore.writeBlob(bis));
}
return ids;
}
代码示例来源:origin: apache/jackrabbit-oak
@Parameterized.Parameters(name="{1}")
public static Collection<Object[]> fixtures() throws Exception {
BlobStore shortIdBlobStore = mock(BlobStore.class);
when(shortIdBlobStore.writeBlob(any())).thenReturn("shortId");
BlobStore longIdBlobStore = mock(BlobStore.class);
when(longIdBlobStore.writeBlob(any())).thenReturn(Strings.repeat("shortId", 1000));
return newArrayList(
new Object[]{null, "No BlobStore"},
new Object[]{shortIdBlobStore, "Short Id BlobStore"},
new Object[]{longIdBlobStore, "Long Id BlobStore"});
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public ArrayBasedBlob createBlob(InputStream in) {
try {
String id = blobStore.writeBlob(in);
return new TestBlob(id, blobStore);
} catch(Exception e) {
log.error("Error in createBlobs", e);
}
return null;
}
代码示例来源:origin: apache/jackrabbit-oak
private Blob blobOf(String content, BlobStore bs) throws IOException {
String id = bs.writeBlob(new ByteArrayInputStream(content.getBytes()));
return new BlobStoreBlob(bs, id);
}
代码示例来源:origin: apache/jackrabbit-oak
public String write(InputStream in) throws DocumentStoreException {
try {
return nodeStore.getBlobStore().writeBlob(in);
} catch (Exception e) {
throw new DocumentStoreException(e);
}
}
代码示例来源:origin: apache/jackrabbit-oak
private void testBlobIdWithLength(int blobIdLength) throws Exception {
String blobId = Strings.repeat("x", blobIdLength);
long blobLength = SegmentTestConstants.MEDIUM_LIMIT;
doReturn(blobId).when(blobStore).writeBlob(any(InputStream.class));
doReturn(blobLength).when(blobStore).getBlobLength(blobId);
SegmentBlob blob = new SegmentBlob(blobStore, fileStore.getWriter().writeStream(newRandomInputStream(blobLength)));
assertEquals(blobLength, blob.length());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test(expected = UnsupportedOperationException.class)
public void writingBinariesIsNotSupported() throws IOException {
given:
{
final BlobStore blobStore = new LoopbackBlobStore();
when:
{
final String test = "Test";
blobStore.writeBlob(adaptToUtf8InputStream(test));
}
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void fileDataStore() throws Exception{
String[] args = {"--fds-path", temporaryFolder.getRoot().getAbsolutePath(), "--read-write"};
try (BlobStoreFixture fixture = BlobStoreFixtureProvider.create(createFDSOptions(args))){
String blobId = fixture.getBlobStore().writeBlob(new ByteArrayInputStream("foo".getBytes()));
assertNotNull(blobId);
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test(expected = UnsupportedOperationException.class)
public void writingBinariesWithBlobOptsIsNotSupported() throws IOException {
given:
{
final BlobStore blobStore = new LoopbackBlobStore();
final BlobOptions blobOptions = new BlobOptions();
when:
{
blobStore.writeBlob(adaptToUtf8InputStream("Test"),
blobOptions);
}
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void blobStoreBlob() throws Exception{
Blob b = new ArrayBasedBlob("hello world".getBytes());
String value = blobStore.writeBlob(b.getNewStream());
String serValue = serializer.serialize(new BlobStoreBlob(blobStore, value));
Blob b2 = serializer.deserialize(serValue);
assertTrue(AbstractBlob.equal(b, b2));
}
内容来源于网络,如有侵权,请联系作者删除!