The assumption here is that for a given set only unique file-names will be loaded and the title field can be used. Later change to use the tags field (
OrigFileName) and strip off the suffix.

@param filename
@return
342324
private boolean checkIfLoaded(String filename) {

        String title;
        if (basefilename.lastIndexOf('.') > 0)
            title = basefilename.substring(0, basefilename.lastIndexOf('.'));
        else
            return false;

        if (filePhotos.containsKey(title))
            return true;

        return false;
    }
39376
protected String getFileName(String fileName) {
        int index = fileName.lastIndexOf('.');
        return (index == -1) ? fileName : fileName.substring(0, index);
    }
874270
private String getFileName(String fileName) {

        if (fileName != null) {
            int index = fileName.indexOf(':');
            if (index < 0) {
                return fileName;
            } else {

                fileName = fileName.substring(index + 1);

                index = fileName.lastIndexOf('/');
                if (index < 0) {
                    return fileName;
                } else {
                    return fileName.substring(index + 1);
                }

            }
        }
        return null;
    }
771136
public boolean removeTag(String tagName) {
    boolean result = false;
    IFD ifd = firstIFD;
    while (ifd != null) {
      if (ifd.containsTagId(TiffTags.getTagId(tagName))) {
        ifd.removeTag(tagName);
      }
      ifd = ifd.getNextIFD();
    }
    createMetadataDictionary();
    return result;
  }
813520
public static String getContentType(final String fileName) {

		if (Util.empty(fileName)) {
			return ConfigurationProperties.getDefaultMimeType();
		}

		String mimeType = null;

		if (fileName.lastIndexOf('.') > -1) {
			String suffix = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
			mimeType = ConfigurationProperties.getFileMimeTypeForExtension(suffix);
		}

		if (mimeType == null) {
			mimeType = URLConnection.guessContentTypeFromName(fileName);
			if (mimeType == null) {
				mimeType = ConfigurationProperties.getDefaultMimeType();
			}
		}

		return mimeType;
	}
391106
private CmsModule getModuleForFileName(String fileName) {

        String moduleName = fileName;
        if (fileName.endsWith(SUFFIX)) {
            moduleName = fileName.substring(0, fileName.length() - SUFFIX.length());
        }
        CmsModule result = OpenCms.getModuleManager().getModule(moduleName);
        return result;
    }
1337291
public static String getHeaderName(final String basename, final String filename) {
    final String base = basename.replaceAll("\\\\", "/");
    final String file = filename.replaceAll("\\\\", "/");
    if (!file.startsWith(base)) {
      throw new IllegalArgumentException("Error " + file + " does not start with " + base);
    }
    String header = file.substring(base.length() + 1);
    header = header.replaceAll("/", "_");
    header = header.replaceAll("\\.class", ".h");
    return header;
  }
23812
public static String getExtension(String fileName) {
        if (fileName == null)
            return null;

        String[] tokens = split(fileName);
        if (tokens.length >= 2)
            return tokens[tokens.length - 1];

        return null;
    }
1114753
public String readFromFile(String fileName) {
    String content = null;
    BufferedReader br = null;
    try {
      File inFile = new File(fileName);
      br = new BufferedReader(new InputStreamReader(
          new FileInputStream(inFile)));
      content = "";
      while(br.ready()) {
      	content += br.readLine();
      }
      br.close();
    } catch (FileNotFoundException ex) {
    	log.error("Failed to find file.", ex);
    } catch (IOException ex) {
    	log.error("Failed to read file.", ex);
    } finally {
    	if(br != null) {
    		try {
    			br.close();
    		} catch(Exception e){}
    	}
    }
    return content;
  }
1234237
public String getFilename(String name)
    {
        List part = (List)_partMap.getValues(name);
        if (part==null)
            return null;
        return ((Part)part.get(0))._filename;
    }
1080260
private static int getIndexFromFilename(String fileName) {
        // remove the beginning of the file name
        String resStr = fileName.replace(
                latestMOTDSerializedFileName.substring(0, latestMOTDSerializedFileName.indexOf("{index}")), "");

        // remove the end of the file name
        resStr = resStr.replace(
                latestMOTDSerializedFileName.substring(latestMOTDSerializedFileName.indexOf("{index}") + 7), "");

        return Integer.parseInt(resStr);
    }
535563
@Pure
	public static String[] extensions(File filename) {
		if (filename == null) {
			return new String[0];
		}
		final String largeBasename = largeBasename(filename);
		final String[] parts = largeBasename.split(Pattern.quote(Character.toString(getFileExtensionCharacter())));
		if (parts.length <= 1) {
			return new String[0];
		}
		final String[] result = new String[parts.length - 1];
		System.arraycopy(parts, 1, result, 0, result.length);
		return result;
	}
1175407
public String removeFileExtension(String fileName) {
        
        int dotIndex = fileName.lastIndexOf(".");
        if (dotIndex > 0) {
            fileName = fileName.substring(0, dotIndex);
        }
        
        return fileName;
    }
61009
@Nonnull
  public final UnifiedResponse setContentDispositionFilename (@Nonnull @Nonempty final String sFilename)
  {
    ValueEnforcer.notEmpty (sFilename, "Filename");

    // Ensure that a valid filename is used
    // -> Strip all paths and replace all invalid characters
    final String sFilenameToUse = FilenameHelper.getWithoutPath (FilenameHelper.getAsSecureValidFilename (sFilename));
    if (!sFilename.equals (sFilenameToUse))
      logWarn ("Content-Dispostion filename was internally modified from '" +
               sFilename +
               "' to '" +
               sFilenameToUse +
               "'");

    // Disabled because of the extended UTF-8 handling (RFC 5987)
    if (false)
    {
      // Check if encoding as ISO-8859-1 is possible
      if (m_aContentDispositionEncoder == null)
        m_aContentDispositionEncoder = StandardCharsets.ISO_8859_1.newEncoder ();
      if (!m_aContentDispositionEncoder.canEncode (sFilenameToUse))
        logError ("Content-Dispostion filename '" + sFilenameToUse + "' cannot be encoded to ISO-8859-1!");
    }

    // Are we overwriting?
    if (m_sContentDispositionFilename != null)
      logInfo ("Overwriting Content-Dispostion filename from '" +
               m_sContentDispositionFilename +
               "' to '" +
               sFilenameToUse +
               "'");

    // No URL encoding necessary.
    // Filename must be in ISO-8859-1
    // See http://greenbytes.de/tech/tc2231/
    m_sContentDispositionFilename = sFilenameToUse;
    return this;
  }
559096
public File inFileNamed(String filenamePattern)
    {
        if (filenamePattern != null && !filenamePattern.isEmpty())
        {
            f.setFilenamePattern(new RegexParameterizedPatternParser(filenamePattern));
        }
        return f;
    }
843164
protected String getFilename(HttpServletRequest request,
      HttpServletResponse response) throws IOException {
    final String filename = request.getParameter("filename");
    if (filename == null || filename.length() == 0) {
      throw new IOException("Invalid filename");
    }
    return filename;
  }
380409
public Response filenameHeader(String filename) {
        if (filename != null && !filename.isEmpty()) {
            header(HttpConstants.Header.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"");
        } else {
            header(HttpConstants.Header.CONTENT_DISPOSITION, "attachment; filename=\"\"");
        }

        return this;
    }