Class Cbsw
A collection of miscellaneous methods
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilechooseFile(String dir, FileFilter filter) Launch a JFileChooser to choose a filestatic javax.xml.bind.UnmarshallercreateUnmarshaller(Class... classes) static voiddump(ByteBuffer bb) static voidCalls a method using Java reflection.static DocumentloadDocument(String xmlPath) Loads a (XML) org.w3c.dom.Document.static booleanSets up a printer job.static voidLaunches system command.static voidtransformDocument(Document doc, String outPath, String xslPath) Writes a backup of a (XML) org.w3c.dom.Document.static ObjectUnmarshal class using XML URL derived from first class arg.static ObjectJAXB unmarshallerstatic Objectstatic Filestatic voidwriteDocumentBackup(Document doc, String xmlPath) Writes a backup of a (XML) org.w3c.dom.Document.
-
Constructor Details
-
Cbsw
public Cbsw()
-
-
Method Details
-
createUnmarshaller
-
urlToFile
-
unmarshal
JAXB unmarshaller
Unmarshal classes from a repository. Unmarshalling creates objects and initialises members of a class instance structure from an XML file.
The URL may point to a file on the web or a local file using the usual URL syntax. The file is cached in the current directory with prefix www- and is used automatically if the remote connection fails.
To prevent overwriting a previously cached file, remove the www- prefix. The unmarshalling always first tries to use the file with no prefix.
- Parameters:
xml- URL of XML dataclasses- The classes that provide the unmarshalling context- Returns:
- The unmarshalled object
-
unmarshal
-
unmarshal
-
exec
-
chooseFile
Launch a JFileChooser to choose a file
- Parameters:
dir- The directory to navigate fromfilter- A file filter- Returns:
- The File
-
print
-
writeDocumentBackup
Writes a backup of a (XML) org.w3c.dom.Document.
The path prefix includes the directory. If the String contains %s it is replaced with a timestamp.
- Parameters:
doc- The document.xmlPath- The file name which optionally contains a single %s token.
-
transformDocument
Writes a backup of a (XML) org.w3c.dom.Document.
The path prefix includes the directory. The function inserts a timestamp before the file extension. Applies a requested transform.
- Parameters:
doc- The document.outPath- The destination file name.xslPath- The transform file name.
-
loadDocument
-
system
Launches system command.
- Parameters:
cmd- Path to executable followed by command-line parameters
-
dump
-