Extract media information for a particular file.

@param filename name of the file
@return media information
@throws MediaInfoParseException if a parse error occurs
509159
public static MediaInfo mediaInfo(String filename) {
        MediaInfo result;
        LibMediaInfo lib = LibMediaInfo.INSTANCE;
        Pointer handle = lib.MediaInfo_New();
        if (handle != null) {
            try {
                int opened = lib.MediaInfo_Open(handle, new WString(filename));
                if (opened == 1) {
                    WString data = lib.MediaInfo_Inform(handle);
                    lib.MediaInfo_Close(handle);
                    result = new Parser(data.toString()).parse();
                }
                else {
                    result = null;
                }
            }
            finally {
                lib.MediaInfo_Delete(handle);
            }
        }
        else {
            result = null;
        }
        return result;
    }
1240494
public static String readFileContent(String filename) throws FileNotFoundException, IOException {
        BufferedReader reader = new BufferedReader(new FileReader(filename));
        StringBuilder content = new StringBuilder();
        String line;
        final String eol = System.getProperty("line.separator");
        while ((line = reader.readLine()) != null) {
            content.append(line);
            content.append(eol);
        }
        reader.close();
        return content.toString();
    }
348304
private int retrieveIndexValueFromFileName(String fileName) {
        int index = 0;
        if (fileName != null && !fileName.trim().isEmpty()) {
            index = Integer.parseInt(fileName.substring(fileName.lastIndexOf('-') + 1,
                    fileName.length() - EXTENSION.length()));
        }
        return index;
    }
1033309
private String getExtension(String fileName) {
		if (fileName == null) {
            return null;
        }

		String ext = null;
		int i = fileName.lastIndexOf('.');

		if (i > 0 && i < fileName.length() - 1) {
			ext = fileName.substring(i + 1).toLowerCase();
		}
		return ext;
	}
788780
private String extractFileName(Part part) {
		String disposition = part.getHeader("Content-Disposition");
		if (disposition == null)
			return null;
		Matcher matcher = FILENAME_PATTERN.matcher(disposition);
		if (!matcher.find())
			return null;
		return matcher.group(1);
	}
39376
protected String getFileName(String fileName) {
        int index = fileName.lastIndexOf('.');
        return (index == -1) ? fileName : fileName.substring(0, index);
    }
980683
async function getSubtitlesByFilename (filename) {
  // TODO: revamp this + add unit tests
  return getSubtitlesList(filename)
    .then(parseSearchResults)
    .then(getBestSearchResult(filename))
    .then(getSubtitlesPage)
    .then(parseDownloadLink)
    .then(downloadZip)
    .then(extractSrt)
}
827243
public String read(String filename) throws IOException {
    Path p = new Path(filename);
    int size = (int) getMfs().getFileStatus(p).getLen();
    FSDataInputStream is = getMfs().open(p);
    byte[] content = new byte[size];
    is.readFully(content);
    return new String(content);
  }
428806
MediaInfo parse() {
        try {
            BufferedReader reader = new BufferedReader(new StringReader(data));
            MediaInfo mediaInfo = new MediaInfo();
            String sectionName;
            String line;
            Sections sections;
            Section section = null;
            while (parseState != ParseState.FINISHED) {
                switch (parseState) {
                    case DEFAULT:
                        parseState = ParseState.NEXT_SECTION;
                        break;
                    case NEXT_SECTION:
                        sectionName = reader.readLine();
                        if (sectionName == null) {
                            parseState = ParseState.FINISHED;
                        }
                        else if (sectionName.length() > 0) {
                            parseState = ParseState.SECTION;
                            sections = mediaInfo.sections(sectionName);
                            section = sections.newSection();
                        }
                        break;
                    case SECTION:
                        line = reader.readLine();
                        if (line == null) {
                            parseState = ParseState.FINISHED;
                        }
                        else if (line.length() == 0) {
                            parseState = ParseState.NEXT_SECTION;
                        }
                        else {
                            String[] values = line.split(":", 2);
                            section.put(values[0].trim(), values[1].trim());
                        }
                        break;
                    default:
                        throw new IllegalStateException();
                }
            }
            return mediaInfo;
        }
        catch (IOException e) {
            throw new MediaInfoParseException("Failed to parse media info", e);
        }
    }
1227567
public function parse($filename)
    {
        $tokens = token_get_all(file_get_contents($filename));
        $classNames = [];
        $interfaceNames = [];
        $traitNames = [];
        $namespace = [];
        $curleys = 0;
        $isInNamespace = false;
        $totalTokens = count($tokens);

        for ($i = 0; $i <= $totalTokens; $i++) {
            if (!isset($tokens[$i])) {
                break;
            }

            $token = $tokens[$i];
            if (is_string($token)) {
                if (in_array($token[0], ['{'])) {
                    $curleys++;
                }

                if (in_array($token[0], ['}'])) {
                    $curleys--;
                }
                $token = [0 => $token];
            }

            // iterate until space to get FQ NS name.
            if ($token[0] == T_NAMESPACE) {
                $namespace = [];
                $i = $i + 2; 
                for (; $i <= $totalTokens; $i++) {
                    if (!isset($tokens[$i])) {
                        break;
                    }
                    $token = $tokens[$i];

                    if ($token[0] == T_STRING) {
                        $namespace[] = $token[1];
                    }

                    if ($token[0] == ';') {
                        $isInNamespace = true;
                        break;
                    }

                    if ($token[0] == '{') {
                        $curleys++;
                        break;
                    }

                    if ($token[0] == '{') {
                        $curleys--;
                    }
                }
            }

            if ($token[0] == T_CLASS) {
                $prevToken = $tokens[$i - 1];
                if (is_array($prevToken) && $prevToken[0] == T_DOUBLE_COLON) {
                    continue;
                }
                
                $i = $i + 2;
                for (; $i <= count($tokens); $i++) {
                    $token = $tokens[$i];
                    if ($token[0] == T_STRING) {
                        if ($curleys == 0 && !$isInNamespace) {
                            $namespace = [];
                        }
                        $classParts = array_merge($namespace, [$token[1]]);
                        $classNames[] = join('\\', $classParts);
                        break;
                    }
                }
            }

            if ($token[0] == T_INTERFACE) {
                $i = $i + 2;
                for (; $i <= count($tokens); $i++) {
                    $token = $tokens[$i];
                    if ($token[0] == T_STRING) {
                        if ($curleys == 0 && !$isInNamespace) {
                            $namespace = [];
                        }
                        $interfaceParts = array_merge($namespace, [$token[1]]);
                        $interfaceNames[] = join('\\', $interfaceParts);
                        break;
                    }
                }
            }

            if ($token[0] == T_TRAIT) {
                $i = $i + 2;
                for (; $i <= count($tokens); $i++) {
                    $token = $tokens[$i];
                    if ($token[0] == T_STRING) {
                        if ($curleys == 0 && !$isInNamespace) {
                            $namespace = [];
                        }
                        $traitParts = array_merge($namespace, [$token[1]]);
                        $traitNames[] = join('\\', $traitParts);
                        break;
                    }
                }
            }
        }
        return [
            'classes' => $classNames,
            'interfaces' => $interfaceNames,
            'traits' => $traitNames
        ];
    }
80307
public String read(final String filename) {
        if (isFresh(filename)) {
            String cachedValue = getFileFromCache(filename);
            if (cachedValue != null) {
                return cachedValue;
            }
        }
        // either fresh is false or cachedValue is null
        loadToCache(filename);
        return getFileFromCache(filename);
    }
645389
private static final String getExtension(String fileName) {
		return fileName.indexOf('.') == -1 ? null : fileName.substring(fileName.lastIndexOf('.') + 1);
	}
1192792
public static byte[] readFileAtOnce(final String filename) throws IOException {
		final FileInputStream fIn = new FileInputStream(filename);
		return readFileAtOnce(fIn);
	}
1320585
public static String getExtension(String fileName) {
		if (fileName==null){
			return null;
		} else {
			int number=fileName.lastIndexOf('.');
			
			if (number>=0){
				return fileName.substring(number+1, fileName.length());
			} else {
				return null;
			}
		}		
	}
1066111
public function parseFile($filename)
    {
        try {
            $data = YamlParser::parseFile($filename, YamlParser::PARSE_CONSTANT);
        } catch (Exception $exception) {
            throw new ParseException(
                [
                    'message'   => 'Error parsing YAML file',
                    'exception' => $exception,
                ]
            );
        }

        return (array)$this->parse($data);
    }
104596
public static Dataset<String, String> readSVMLightFormat(String filename) {
    return readSVMLightFormat(filename, new HashIndex<String>(), new HashIndex<String>());
  }
324681
public ProvFormat getTypeForFile(String filename) {
        int count = filename.lastIndexOf(".");
        if (count == -1)
            return null;
        String extension = filename.substring(count + 1);
        return extensionRevMap.get(extension);
    }