Package gov.nasa.pds.tools.util
Class FileService
- java.lang.Object
-
- gov.nasa.pds.tools.util.FileService
-
public class FileService extends Object
A class to allow reading and writing text file.
-
-
Constructor Summary
Constructors Constructor Description FileService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appendTextToOneLine(String filename, String textStr)
Open the file for writing and write a text string.static void
appendTextToOneLine(String filename, String[] textArray)
Open the file for writing and write textArray separated by a space to file all in one line.static void
main(String[] args)
static void
printDocumentToFile(String filename, DOMSource domSource)
Print a document (DOMSource) to a text file.static void
printDocumentToFile(String filename, Document docSource)
Print a document to a text file.static void
printStackTraceToFile(String filename, Exception exception)
Print a stack trace to a text file.
-
-
-
Method Detail
-
main
public static void main(String[] args)
-
appendTextToOneLine
public static void appendTextToOneLine(String filename, String textStr)
Open the file for writing and write a text string.- Parameters:
filename
- Output filenametextArray
- An array of strings
-
appendTextToOneLine
public static void appendTextToOneLine(String filename, String[] textArray)
Open the file for writing and write textArray separated by a space to file all in one line.- Parameters:
filename
- Output filenametextArray
- An array of strings
-
printStackTraceToFile
public static void printStackTraceToFile(String filename, Exception exception)
Print a stack trace to a text file.- Parameters:
filename
- Output filename.exception
- The exception to print stack trace of.
-
printDocumentToFile
public static void printDocumentToFile(String filename, Document docSource)
Print a document to a text file.- Parameters:
filename
- Output filename.docSource
- The document (Document) to be printed
-
-