@Test public void segment_path() { FileSegmenter segmenter = new FileSegmenter(Paths.get("base"), 1, 1); assertThat("segment 0", segmenter.pathOf(0), is(Paths.get("base"))); assertThat("segment 1", segmenter.pathOf(1), is(Paths.get("base.001"))); assertThat("segment 2", segmenter.pathOf(2), is(Paths.get("base.002"))); assertThat("segment 1000", segmenter.pathOf(1000), is(Paths.get("base.1000"))); }
public Path pathOf(int segment) { if (segment == 0) { return base; } String suffix = String.format(".%03d", segment); return base.resolveSibling(base.getFileName() + suffix); }
FileSegmenter { public Path pathOf(int segment) { if (segment == 0) { return base; } String suffix = String.format(".%03d", segment); return base.resolveSibling(base.getFileName() + suffix); } }
FileSegmenter { public Path pathOf(int segment) { if (segment == 0) { return base; } String suffix = String.format(".%03d", segment); return base.resolveSibling(base.getFileName() + suffix); } FileSegmenter(Path base, int initialSize, int maxSize); }
FileSegmenter { public Path pathOf(int segment) { if (segment == 0) { return base; } String suffix = String.format(".%03d", segment); return base.resolveSibling(base.getFileName() + suffix); } FileSegmenter(Path base, int initialSize, int maxSize); Path pathOf(int segment); int sizeOf(int segment); }
FileSegmenter { public Path pathOf(int segment) { if (segment == 0) { return base; } String suffix = String.format(".%03d", segment); return base.resolveSibling(base.getFileName() + suffix); } FileSegmenter(Path base, int initialSize, int maxSize); Path pathOf(int segment); int sizeOf(int segment);  }