HdfsOffsetComputer implements OffsetComputer { @Override public long getIndex(String fileName) { Matcher matcher = offsetFilePatternGenerator.matcher(fileName); if (matcher.matches()) { try { return Long.parseLong(matcher.group("index")); } catch (NumberFormatException e) { LOGGER.info("Couldn't deviate a valid index from '{}'", fileName); } } return 0L; } HdfsOffsetComputer(FileSystem fs, Path basePath, int backlogDays);  HdfsOffsetComputer(FileSystem fs, Path basePath, @Nullable String kafkaCluster, int backlogDays); @Override Map<Integer, Long> computeOffsets(Collection<Integer> partitionIds); @Override String computeDirName(LocalDateTime time); @Override long getIndex(String fileName); @Override String computeTopicGlob(LocalDateTime time, int partition); @Override String computePath(LocalDateTime time, long index, int partition);  }
@Test public void getIndexReturnFileIndex() { Assert.assertEquals(1, offsetComputer.getIndex("123.index=1.12")); }
@Test public void getIndexReturn0IfNoIndex() { Assert.assertEquals(0, offsetComputer.getIndex("123.12")); }