com.simiacryptus.util.Util.cacheStream()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(171)

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

Util.cacheStream介绍

[英]Cache input stream.
[中]缓存输入流。

代码示例

代码示例来源:origin: com.simiacryptus/java-util

/**
 * Cache input stream.
 *
 * @param url the url
 * @return the input stream
 * @throws IOException              the io exception
 * @throws NoSuchAlgorithmException the no such algorithm exception
 * @throws KeyManagementException   the key management exception
 */
public static InputStream cacheStream(@javax.annotation.Nonnull final URI url) throws IOException, NoSuchAlgorithmException, KeyManagementException {
 return com.simiacryptus.util.Util.cacheStream(url.toString(), new File(url.getPath()).getName());
}

代码示例来源:origin: com.simiacryptus/mindseye-labs

private static Stream<byte[]> binaryStream(@Nonnull final String name, final int skip, final int recordSize) throws IOException {
 @Nullable InputStream stream = null;
 try {
  stream = Util.cacheStream(TestUtil.S3_ROOT.resolve(name));
 } catch (@Nonnull NoSuchAlgorithmException | KeyManagementException e) {
  throw new RuntimeException(e);
 }
 final byte[] fileData = IOUtils.toByteArray(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(stream))));
 @Nonnull final DataInputStream in = new DataInputStream(new ByteArrayInputStream(fileData));
 in.skip(skip);
 return MNIST.toIterator(new BinaryChunkIterator(in, recordSize));
}

代码示例来源:origin: com.simiacryptus/mindseye-test

private static Stream<byte[]> binaryStream(@Nonnull final String name, final int skip, final int recordSize) throws IOException {
 @Nullable InputStream stream = null;
 try {
  stream = Util.cacheStream(TestUtil.S3_ROOT.resolve(name));
 } catch (@Nonnull NoSuchAlgorithmException | KeyManagementException e) {
  throw new RuntimeException(e);
 }
 final byte[] fileData = IOUtils.toByteArray(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(stream))));
 @Nonnull final DataInputStream in = new DataInputStream(new ByteArrayInputStream(fileData));
 in.skip(skip);
 return MNIST.toIterator(new BinaryChunkIterator(in, recordSize));
}

代码示例来源:origin: com.simiacryptus/mindseye

private static Stream<byte[]> binaryStream(@Nonnull final String name, final int skip, final int recordSize) throws IOException {
 @Nullable InputStream stream = null;
 try {
  stream = Util.cacheStream(TestUtil.S3_ROOT.resolve(name));
 } catch (@Nonnull NoSuchAlgorithmException | KeyManagementException e) {
  throw new RuntimeException(e);
 }
 final byte[] fileData = IOUtils.toByteArray(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(stream))));
 @Nonnull final DataInputStream in = new DataInputStream(new ByteArrayInputStream(fileData));
 in.skip(skip);
 return MNIST.toIterator(new BinaryChunkIterator(in, recordSize));
}

相关文章