Java tutorial
//package com.java2s; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.util.TreeMap; public class Main { private static TreeMap<String, String> pathMap; public static OutputStream U7create(String nm) throws IOException { String fname = getSystemPath(nm); return new BufferedOutputStream(new FileOutputStream(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); } }