Class DocViewFormat
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.io.DocViewFormat
-
public class DocViewFormat extends Object
This class provides access to the commonly used doc view xml format and functionality that checks files for the format or reformats them accordingly.
-
-
Constructor Summary
Constructors Constructor Description DocViewFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
format(File file, boolean dryRun)
Formats a given file using theOutputFormat
returned bygetXmlOutputFormat()
.List<String>
format(File directory, List<Pattern> filenamePatterns, boolean dryRun)
Formats given files using theOutputFormat
returned bygetXmlOutputFormat()
by traversing the directory tree given as file.OutputFormat
getXmlOutputFormat()
Returns theOutputFormat
used byDocViewSerializer
when writing doc view xml files.
-
-
-
Method Detail
-
getXmlOutputFormat
public OutputFormat getXmlOutputFormat()
Returns theOutputFormat
used byDocViewSerializer
when writing doc view xml files.- Returns:
- the output format
-
format
public boolean format(File file, boolean dryRun) throws IOException
Formats a given file using theOutputFormat
returned bygetXmlOutputFormat()
. The file is replaced on disk but only if wasn't already formatted correctly and ifdryRun
isfalse
.- Parameters:
file
- the file to formatdryRun
- Iftrue
, then the file is never replaced on disk.- Returns:
true
if the formatted version differs from the original.- Throws:
IOException
- if an I/O error occurs
-
format
public List<String> format(File directory, List<Pattern> filenamePatterns, boolean dryRun) throws IOException
Formats given files using theOutputFormat
returned bygetXmlOutputFormat()
by traversing the directory tree given as file. Only those files will be formatted, that have a filename matching at least one of the given filenamePatterns, and only ifdryRun
isfalse
.- Parameters:
directory
- the start directoryfilenamePatterns
- list of regexp patternsdryRun
- Iftrue
, then the file is never replaced on disk.- Returns:
- a list of relative paths of those files which are not formatted correctly according to
format(File, boolean)
- Throws:
IOException
- in case there is an exception during traversal or formatting. That means formatting will fail on the first error that appeared
-
-