@Nullable
  public static String getFileExtension(String filename) {
    int index = filename.lastIndexOf('.');
    return index == -1 ? null : filename.substring(index + 1);
  }
Returns the text read from the given stream as a String.
Closes the given stream upon return.
spock-core/src/main/java/org/spockframework/util/IoUtil.java