Java tutorial
//package com.java2s; import java.io.InputStream; import java.io.FileInputStream; import java.io.BufferedInputStream; import java.io.IOException; import java.util.TreeMap; public class Main { private static TreeMap<String, String> pathMap; public static InputStream U7openStream(String nm) throws IOException { String fname = getSystemPath(nm); return new BufferedInputStream(new FileInputStream(fname), 0x8000); } public static String getSystemPath(String path) { String newPath; int pos, pos2; pos = path.indexOf('>'); pos2 = path.indexOf('<'); // If there is no separator, return the path as is if (pos == -1 || pos2 != 0) { newPath = path; } else { pos += 1; // See if we can translate this prefix String syspath = path.substring(0, pos); if (isSystemPathDefined(syspath)) { String newPrefix = pathMap.get(syspath); newPath = newPrefix + path.substring(pos); } else { newPath = path; } } return newPath; } public static boolean isSystemPathDefined(String path) { return pathMap != null && pathMap.containsKey(path); } }