code: protected static String fileLocationTransform(String location, int segment) {
        if (location.endsWith(File.separator)) {
           return location.substring(0, location.length() - 1) + "-" + segment + File.separatorChar;
        }
        return location + File.separatorChar + segment;
     }
docs: Transforms a file location to a segment based one. This is useful for file based stores where all you need to
  do is append a segment to the name of the directory. If the provided location is a directory, that is that it is
  terminated by in {@link File#separatorChar}, it will add a new directory onto that that is the segment. If the
  location is a file, that is that it is not terminated by {@link File#separatorChar}, this will treat the location
  as a directory and append a segment file in it. The underlying store may or may not preseve this and could still
  turn the segment into a directory.
  @param location original file location
  @param segment the segment to append
  @return string with the segment appended to the file location