test_class.declarator: factory = new GuavaBloomFilterFactory()
test_class.modifier: private final
test_class.original_string: private final GuavaBloomFilterFactory factory = new GuavaBloomFilterFactory();
test_class.type: GuavaBloomFilterFactory
test_class.var_name: factory
test_class.declarator: writeRecordChannel
test_class.modifier: private
test_class.original_string: private FileChannel writeRecordChannel;
test_class.type: FileChannel
test_class.var_name: writeRecordChannel
test_class.declarator: tempFile
test_class.modifier: private
test_class.original_string: private File tempFile;
test_class.type: File
test_class.var_name: tempFile
test_class.declarator: tempDir
test_class.modifier: private
test_class.original_string: private String tempDir;
test_class.type: String
test_class.var_name: tempDir
test_class.file: filter-service-core/src/test/java/cn/leancloud/filter/service/FilterRecordInputStreamTest.java
test_class.identifier: FilterRecordInputStreamTest
test_case.body: @Test
      public void testReadWriteMultiFilterRecord() throws Exception {
          final List<FilterRecord<BloomFilter>> records = generateFilterRecords(100);
          for (FilterRecord<BloomFilter> record : records) {
              record.writeFullyTo(writeRecordChannel);
          }
  
          try (FilterRecordInputStream<GuavaBloomFilter> stream = new FilterRecordInputStream<>(tempFile.toPath(), factory)) {
              for (FilterRecord<BloomFilter> expectRecord : records) {
                  assertThat(stream.nextFilterRecord()).isEqualTo(expectRecord);
              }
  
              assertThat(stream.nextFilterRecord()).isNull();
          }
      }
test_case.class_method_signature: FilterRecordInputStreamTest.testReadWriteMultiFilterRecord()
test_case.full_signature: @Test public void testReadWriteMultiFilterRecord()
test_case.identifier: testReadWriteMultiFilterRecord
test_case.invocations: generateFilterRecords writeFullyTo toPath isEqualTo assertThat nextFilterRecord isNull assertThat nextFilterRecord
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadWriteMultiFilterRecord()
focal_class.declarator: channel
focal_class.modifier: private final
focal_class.original_string: private final FileChannel channel;
focal_class.type: FileChannel
focal_class.var_name: channel
focal_class.declarator: recordFilePath
focal_class.modifier: private final
focal_class.original_string: private final Path recordFilePath;
focal_class.type: Path
focal_class.var_name: recordFilePath
focal_class.declarator: end
focal_class.modifier: private final
focal_class.original_string: private final long end;
focal_class.type: long
focal_class.var_name: end
focal_class.declarator: headerBuffer
focal_class.modifier: private final
focal_class.original_string: private final ByteBuffer headerBuffer;
focal_class.type: ByteBuffer
focal_class.var_name: headerBuffer
focal_class.declarator: factory
focal_class.modifier: private final
focal_class.original_string: private final BloomFilterFactory<F, ?> factory;
focal_class.type: BloomFilterFactory<F, ?>
focal_class.var_name: factory
focal_class.declarator: position
focal_class.modifier: private
focal_class.original_string: private long position;
focal_class.type: long
focal_class.var_name: position
focal_class.file: filter-service-core/src/main/java/cn/leancloud/filter/service/FilterRecordInputStream.java
focal_class.identifier: FilterRecordInputStream
focal_class.interfaces: implements Closeable
focal_class.class_method_signature: FilterRecordInputStream.readFully(FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.full_signature: private static void readFully(FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.identifier: readFully
focal_class.modifiers: private static
focal_class.parameters: (FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.return: void
focal_class.signature: void readFully(FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.class_method_signature: FilterRecordInputStream.readFullyOrFail(FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.full_signature: static void readFullyOrFail(FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.identifier: readFullyOrFail
focal_class.modifiers: static
focal_class.parameters: (FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.return: void
focal_class.signature: void readFullyOrFail(FileChannel channel, ByteBuffer destinationBuffer, long position)
focal_class.class_method_signature: FilterRecordInputStream.FilterRecordInputStream(Path recordFilePath, BloomFilterFactory<F, ?> factory)
focal_class.full_signature: public  FilterRecordInputStream(Path recordFilePath, BloomFilterFactory<F, ?> factory)
focal_class.identifier: FilterRecordInputStream
focal_class.modifiers: public
focal_class.parameters: (Path recordFilePath, BloomFilterFactory<F, ?> factory)
focal_class.signature:  FilterRecordInputStream(Path recordFilePath, BloomFilterFactory<F, ?> factory)
focal_class.class_method_signature: FilterRecordInputStream.nextFilterRecord()
focal_class.full_signature: @Nullable public FilterRecord<? extends F> nextFilterRecord()
focal_class.identifier: nextFilterRecord
focal_class.modifiers: @Nullable public
focal_class.parameters: ()
focal_class.return: FilterRecord<? extends F>
focal_class.signature: FilterRecord<? extends F> nextFilterRecord()
focal_class.class_method_signature: FilterRecordInputStream.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: FilterRecordInputStream.checkMagic(ByteBuffer headerBuffer)
focal_class.full_signature: private void checkMagic(ByteBuffer headerBuffer)
focal_class.identifier: checkMagic
focal_class.modifiers: private
focal_class.parameters: (ByteBuffer headerBuffer)
focal_class.return: void
focal_class.signature: void checkMagic(ByteBuffer headerBuffer)
focal_class.class_method_signature: FilterRecordInputStream.checkCrc(ByteBuffer headerBuffer, ByteBuffer bodyBuffer)
focal_class.full_signature: private void checkCrc(ByteBuffer headerBuffer, ByteBuffer bodyBuffer)
focal_class.identifier: checkCrc
focal_class.modifiers: private
focal_class.parameters: (ByteBuffer headerBuffer, ByteBuffer bodyBuffer)
focal_class.return: void
focal_class.signature: void checkCrc(ByteBuffer headerBuffer, ByteBuffer bodyBuffer)
focal_class.class_method_signature: FilterRecordInputStream.readFilterNameBuffer(ByteBuffer bodyBuffer)
focal_class.full_signature: private ByteBuffer readFilterNameBuffer(ByteBuffer bodyBuffer)
focal_class.identifier: readFilterNameBuffer
focal_class.modifiers: private
focal_class.parameters: (ByteBuffer bodyBuffer)
focal_class.return: ByteBuffer
focal_class.signature: ByteBuffer readFilterNameBuffer(ByteBuffer bodyBuffer)
focal_class.class_method_signature: FilterRecordInputStream.readCrc(ByteBuffer headerBuffer)
focal_class.full_signature: private long readCrc(ByteBuffer headerBuffer)
focal_class.identifier: readCrc
focal_class.modifiers: private
focal_class.parameters: (ByteBuffer headerBuffer)
focal_class.return: long
focal_class.signature: long readCrc(ByteBuffer headerBuffer)
focal_method.body: @Nullable
      public FilterRecord<? extends F> nextFilterRecord() throws IOException {
          if (end - position <= HEADER_OVERHEAD) {
              if (end == position) {
                  return null;
              }
  
              throw shortReadFilterHeader(recordFilePath.toString(), (int) (HEADER_OVERHEAD - (end - position)));
          }
  
          headerBuffer.rewind();
          readFullyOrFail(channel, headerBuffer, position);
          headerBuffer.rewind();
  
          final int bodyLen = headerBuffer.getInt(BODY_LENGTH_OFFSET);
          if (end - position < HEADER_OVERHEAD + bodyLen) {
              throw shortReadFilterBody(recordFilePath.toString(), (int) ((bodyLen + HEADER_OVERHEAD) - (end - position)));
          }
  
          checkMagic(headerBuffer);
  
          final ByteBuffer bodyBuffer = ByteBuffer.allocate(bodyLen);
          readFullyOrFail(channel, bodyBuffer, position + HEADER_OVERHEAD);
          bodyBuffer.flip();
  
          checkCrc(headerBuffer, bodyBuffer);
  
          final ByteBuffer filterNameBuffer = readFilterNameBuffer(bodyBuffer);
          final String name = StandardCharsets.UTF_8.decode(filterNameBuffer).toString();
          final F filter = factory.readFrom(new ByteArrayInputStream(bodyBuffer.array(),
                  bodyBuffer.position() + filterNameBuffer.limit(), bodyBuffer.remaining()));
  
          // every thing is fine, we move position forward
          position += bodyLen + HEADER_OVERHEAD;
          return new FilterRecord<>(name, filter);
      }
focal_method.class_method_signature: FilterRecordInputStream.nextFilterRecord()
focal_method.full_signature: @Nullable public FilterRecord<? extends F> nextFilterRecord()
focal_method.identifier: nextFilterRecord
focal_method.invocations: shortReadFilterHeader toString rewind readFullyOrFail rewind getInt shortReadFilterBody toString checkMagic allocate readFullyOrFail flip checkCrc readFilterNameBuffer toString decode readFrom array position limit remaining
focal_method.modifiers: @Nullable public
focal_method.parameters: ()
focal_method.return: FilterRecord<? extends F>
focal_method.signature: FilterRecord<? extends F> nextFilterRecord()