This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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