org.apache.jackrabbit.oak.spi.blob.BlobStore.readBlob()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(146)

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

BlobStore.readBlob介绍

[英]Read a number of bytes from a blob.
[中]从blob中读取若干字节。

代码示例

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

@Override
public int read(byte[] b, int off, int len) throws IOException {
  int l;
  try {
    l = store.readBlob(id, pos, b, off, len);
  } catch (Exception e) {
    throw new IOException(e);
  }
  if (l < 0) {
    return l;
  }
  pos += l;
  return l;
}

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

@Override
public int read(byte[] b, int off, int len) throws IOException {
  int l;
  try {
    l = store.readBlob(id, pos, b, off, len);
  } catch (Exception e) {
    throw new IOException(e);
  }
  if (l < 0) {
    return l;
  }
  pos += l;
  return l;
}

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

@Override
public int read(byte[] b, int off, int len) throws IOException {
  int l;
  try {
    l = store.readBlob(id, pos, b, off, len);
  } catch (Exception e) {
    throw new IOException(e);
  }
  if (l < 0) {
    return l;
  }
  pos += l;
  return l;
}

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

@Override
public int readBlob(String blobId, long pos, byte[] buff, int off, int length) throws IOException {
  return chooseBlobStoreByBlobId(blobId).readBlob(blobId, pos, buff, off, length);
}

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

@Override
public int readBlob(String blobId, long pos, byte[] buff, int off, int length) throws IOException {
  return chooseBlobStoreByBlobId(blobId).readBlob(blobId, pos, buff, off, length);
}

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

@Override
public int readBlob(String blobId, long pos, byte[] buff, int off, int length) throws IOException {
  return chooseBlobStoreByBlobId(blobId).readBlob(blobId, pos, buff, off, length);
}

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

public int read(String blobId, long pos, byte[] buff, int off, int length) throws MicroKernelException {
  if (rep == null) {
    throw new IllegalStateException("this instance has already been disposed");
  }
  try {
    int read = rep.getBlobStore().readBlob(blobId, pos, buff, off, length);
    return read < 0 ? 0 : read;
  } catch (Exception e) {
    throw new MicroKernelException(e);
  }
}

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

public int read(String blobId, long pos, byte[] buff, int off, int length)
    throws DocumentStoreException {
  try {
    int read = nodeStore.getBlobStore().readBlob(blobId, pos, buff, off, length);
    return read < 0 ? 0 : read;
  } catch (Exception e) {
    throw new DocumentStoreException(e);
  }
}

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

@Test
public void testReadByte() throws IOException {
  byte[] expected = new byte[LENGTH];
  byte[] actual = new byte[LENGTH];
  for (String id : oldBlobIds) {
    oldBlobStore.readBlob(id, 0, expected, 0, LENGTH);
    splitBlobStore.readBlob(id, 0, actual, 0, LENGTH);
    assertArrayEquals(expected, actual);
  }
  for (String id : newBlobIds) {
    newBlobStore.readBlob(id, 0, expected, 0, LENGTH);
    splitBlobStore.readBlob(id, 0, actual, 0, LENGTH);
    assertArrayEquals(expected, actual);
  }
}

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

when:
  final int numberOfBytesRead = blobStore.readBlob(
      blobId, offsetToRead, buffer, bufOffset, lengthToRead);
  and:

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

@Test(expected = IllegalArgumentException.class)
@Parameters(method = "blobIdsFailedOffsetReadsCases")
public void getInputStreamShouldAlwaysReturnExceptionIfBinaryOffsetIsBad(
    final String blobId,
    int offsetToRead,
    int bufSize,
    int bufOffset,
    int lengthToRead) throws IOException {
  given:
  {
    final BlobStore store = new LoopbackBlobStore();
    final byte[] buffer = new byte[bufSize];
    when:
    {
      store.readBlob(
          blobId, offsetToRead, buffer, bufOffset, lengthToRead);
    }
  }
}

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

@Test(expected = UnsupportedOperationException.class)
@Parameters(method = "blobIdsFailedBufferReadsCases")
public void getInputStreamShouldAlwaysReturnExceptionIfBufferTooSmall(
    final String blobId,
    int offsetToRead,
    int bufSize,
    int bufOffset,
    int lengthToRead) throws IOException {
  given:
  {
    final BlobStore store = new LoopbackBlobStore();
    final byte[] buffer = new byte[bufSize];
    when:
    {
      store.readBlob(
          blobId, offsetToRead, buffer, bufOffset, lengthToRead);
    }
  }
}

相关文章