MCPcopy Create free account
hub / github.com/PCGen/pcgen / write

Method write

code/src/java/pcgen/io/PCGenExportHandler.java:30–65  ·  view source on GitHub ↗
(PlayerCharacter aPC, BufferedWriter out)

Source from the content-addressed store, hash-verified

28 }
29
30 @Override
31 public void write(PlayerCharacter aPC, BufferedWriter out)
32 {
33 // Set an output filter based on the type of template in use.
34 FileAccess.setCurrentOutputFilter(getTemplateFile().getName());
35
36 try (FileInputStream fis = new FileInputStream(getTemplateFile());
37 InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
38 BufferedReader br = new BufferedReader(isr))
39 {
40 // A Buffer to hold the result of the preparation
41 CharSequence template = prepareTemplate(br);
42
43 // Create a tokenizer based on EOL characters
44 // 03-Nov-2008 Karianna, changed to use line separator instead of /r/n
45 final StringTokenizer tokenizer = new StringTokenizer(template.toString(), Constants.LINE_SEPARATOR, false);
46
47 // Get FOR loops and IIF statements
48 final FORNode root = parseFORsAndIIFs(tokenizer);
49
50 // TODO Not sure what these lines are for
51 loopVariables.put(null, "0");
52 existsOnly = false;
53
54 // Ensure that there 'are more items to process'
55 noMoreItems = false;
56
57 // Now actually process the FOR loops in the template
58 // and then clear the loop variables
59 loopFOR(root, 0, 0, 1, out, aPC);
60 loopVariables.clear();
61 } catch (IOException exc)
62 {
63 Logging.errorPrint("Error in ExportHandler::write", exc);
64 }
65 }
66
67
68 /**

Callers

nothing calls this directly

Calls 10

prepareTemplateMethod · 0.95
parseFORsAndIIFsMethod · 0.95
errorPrintMethod · 0.95
getTemplateFileMethod · 0.80
loopFORMethod · 0.80
getNameMethod · 0.65
toStringMethod · 0.65
putMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected