@Test public void readUncompressed() throws Exception { FilePos pos = create(Compression.NONE); GCCloseable<FileChannel> fd = new GCCloseable<>(FileChannel.open(file, StandardOpenOption.READ)); FileChannelSegmentReader<XdrAbleImpl> reader = new FileChannelSegmentReader<>(XdrAbleImpl::new, fd, pos, Compression.NONE); assertEquals(Compression.NONE, reader.getCompression()); assertEquals(expected, reader.decode()); }
@Override public T decode() throws IOException, OncRpcException { try (XdrDecodingFileReader reader = new XdrDecodingFileReader(compression.wrap(new Crc32VerifyingFileReader(new FileChannelReader(file.get(), pos.getOffset()), pos.getLen(), 4)))) { reader.beginDecoding(); T instance = type.get(); LOG.log(Level.FINEST, "decoding {0} at {1}", new Object[]{instance.getClass(), pos}); instance.xdrDecode(reader); reader.endDecoding(); return instance; } }
FileChannelSegmentReader implements SegmentReader<T> { @Override public T decode() throws IOException, OncRpcException { try (XdrDecodingFileReader reader = new XdrDecodingFileReader(compression.wrap(new Crc32VerifyingFileReader(new FileChannelReader(file.get(), pos.getOffset()), pos.getLen(), 4)))) { reader.beginDecoding(); T instance = type.get(); LOG.log(Level.FINEST, "decoding {0} at {1}", new Object[]{instance.getClass(), pos}); instance.xdrDecode(reader); reader.endDecoding(); return instance; } } }
FileChannelSegmentReader implements SegmentReader<T> { @Override public T decode() throws IOException, OncRpcException { try (XdrDecodingFileReader reader = new XdrDecodingFileReader(compression.wrap(new Crc32VerifyingFileReader(new FileChannelReader(file.get(), pos.getOffset()), pos.getLen(), 4)))) { reader.beginDecoding(); T instance = type.get(); LOG.log(Level.FINEST, "decoding {0} at {1}", new Object[]{instance.getClass(), pos}); instance.xdrDecode(reader); reader.endDecoding(); return instance; } }  }
FileChannelSegmentReader implements SegmentReader<T> { @Override public T decode() throws IOException, OncRpcException { try (XdrDecodingFileReader reader = new XdrDecodingFileReader(compression.wrap(new Crc32VerifyingFileReader(new FileChannelReader(file.get(), pos.getOffset()), pos.getLen(), 4)))) { reader.beginDecoding(); T instance = type.get(); LOG.log(Level.FINEST, "decoding {0} at {1}", new Object[]{instance.getClass(), pos}); instance.xdrDecode(reader); reader.endDecoding(); return instance; } }  @Override T decode(); }
FileChannelSegmentReader implements SegmentReader<T> { @Override public T decode() throws IOException, OncRpcException { try (XdrDecodingFileReader reader = new XdrDecodingFileReader(compression.wrap(new Crc32VerifyingFileReader(new FileChannelReader(file.get(), pos.getOffset()), pos.getLen(), 4)))) { reader.beginDecoding(); T instance = type.get(); LOG.log(Level.FINEST, "decoding {0} at {1}", new Object[]{instance.getClass(), pos}); instance.xdrDecode(reader); reader.endDecoding(); return instance; } }  @Override T decode();  }