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

Method write

code/src/java/pcgen/io/PCGIOHandler.java:220–237  ·  view source on GitHub ↗

Writes the contents of the given PlayerCharacter to a stream author: Thomas Behr 11-03-02 @param pcToBeWritten the PlayerCharacter to write @param out the stream to be written to @deprecated The write to a file method should be used in preference as it has safe backup handling.

(PlayerCharacter pcToBeWritten, GameMode mode, List<Campaign> campaigns, OutputStream out)

Source from the content-addressed store, hash-verified

218 * @deprecated The write to a file method should be used in preference as it has safe backup handling.
219 */
220 @Deprecated
221 @Override
222 public void write(PlayerCharacter pcToBeWritten, GameMode mode, List<Campaign> campaigns, OutputStream out)
223 {
224 final String pcgString;
225 pcgString = (new PCGVer2Creator(pcToBeWritten, mode, campaigns)).createPCGString();
226
227 try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8)))
228 {
229 bw.write(pcgString);
230 bw.flush();
231
232 pcToBeWritten.setDirty(false);
233 } catch (IOException ioe)
234 {
235 Logging.errorPrint("Exception in PCGIOHandler::write", ioe);
236 }
237 }
238
239 /**
240 * Writes the contents of the given PlayerCharacter to a file. This method also includes

Callers 1

saveMethod · 0.95

Calls 11

errorPrintMethod · 0.95
getVersionNumberMethod · 0.95
findRelativePathMethod · 0.95
createPCGStringMethod · 0.80
createBackupForFileMethod · 0.80
joinMethod · 0.80
writeMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
flushMethod · 0.45
setDirtyMethod · 0.45

Tested by

no test coverage detected