@Test @SneakyThrows void read() { createFileWithMessage(); try (InputStream read = storageService.read(fileWithMsg)) { assertThat(read).hasContent(MESSAGE); } }
@SneakyThrows @Override public InputStream read(AbsoluteLocation path) { log.debug("Read file request: {}",path.location()); Path filePath = resolve(path.location().getRawPath(), false); return MoreFiles.asByteSource(filePath, StandardOpenOption.READ).openStream(); }
FileSystemStorageService implements StorageService { @SneakyThrows @Override public InputStream read(AbsoluteLocation path) { log.debug("Read file request: {}",path.location()); Path filePath = resolve(path.location().getRawPath(), false); return MoreFiles.asByteSource(filePath, StandardOpenOption.READ).openStream(); } }
FileSystemStorageService implements StorageService { @SneakyThrows @Override public InputStream read(AbsoluteLocation path) { log.debug("Read file request: {}",path.location()); Path filePath = resolve(path.location().getRawPath(), false); return MoreFiles.asByteSource(filePath, StandardOpenOption.READ).openStream(); } FileSystemStorageService(Path dir); }
FileSystemStorageService implements StorageService { @SneakyThrows @Override public InputStream read(AbsoluteLocation path) { log.debug("Read file request: {}",path.location()); Path filePath = resolve(path.location().getRawPath(), false); return MoreFiles.asByteSource(filePath, StandardOpenOption.READ).openStream(); } FileSystemStorageService(Path dir); @SneakyThrows @Override Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation path); @SneakyThrows @Override InputStream read(AbsoluteLocation path); @SneakyThrows @Override OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback); @SneakyThrows @Override void remove(AbsoluteLocation location); @Override boolean objectExists(AbsoluteLocation location); }
FileSystemStorageService implements StorageService { @SneakyThrows @Override public InputStream read(AbsoluteLocation path) { log.debug("Read file request: {}",path.location()); Path filePath = resolve(path.location().getRawPath(), false); return MoreFiles.asByteSource(filePath, StandardOpenOption.READ).openStream(); } FileSystemStorageService(Path dir); @SneakyThrows @Override Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation path); @SneakyThrows @Override InputStream read(AbsoluteLocation path); @SneakyThrows @Override OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback); @SneakyThrows @Override void remove(AbsoluteLocation location); @Override boolean objectExists(AbsoluteLocation location);  }