Code example for StringWriter

Methods: closetoString

0
	private void paintSnapshot() { 
		if (paintSnapshot) {
			String text = null;
 
			if (lastSnapshot != null) {
				final StringWriter writer = new StringWriter();
				final XmlWriter xmlWriter = new XmlWriter(writer, true);
 
				try { 
					((IXmlSerializable) lastSnapshot).writeXml(xmlWriter, new SerializableOptions(false));
					writer.close();
				} catch (IOException e) {
					Logger.logError(e);
				} 
				text = writer.toString();
			} 
			getTurnSnapshotScrollPane().setText(text);
		} 
	} 
 
Experience pair programming with AI  Get Codota for Java