code: public void setFileTypeOrName(String type) {
          fileTypeOrName = type;
          if ((fileAsBufferedImage != null) && !ImageIO.getImageWritersByFormatName(getFileType()).hasNext()) {
              throw new IllegalArgumentException(String.format("No image writer found for format \"%s\"", getFileType()));
          }
      }
docs: Sets the type ("png", "txt", ...) or name ("image.png", "readme.txt", ...) of the file.
  
  @param type The type or name of the file.