Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.io.*;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class Graphml2FileSystemStdin {
public static void main(String[] args) {
Multimap<String, String> parentToChildren = HashMultimap.create();
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(System.in));
String line;
while ((line = br.readLine()) != null) {
// log message
System.err.println("[DEBUG] current line is: " + line);
String[] elements = line.split("::");
String parent = elements[0];
String child = elements[1];
parentToChildren.put(parent, child);
// program output
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment