public class Util extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
MANIFEST_PATH |
static int |
READ_BUFFER_SIZE |
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static Pattern |
compile(SrxDocument document,
String regex) |
static void |
copyAll(Reader reader,
Writer writer)
Copies the whole content of a reader to a writer.
|
static String |
finitize(String pattern,
int infinity)
Changes unlimited length pattern to limited length pattern.
|
static javax.xml.bind.JAXBContext |
getContext(Class<?>... classesToBeBound) |
static javax.xml.bind.JAXBContext |
getContext(String context) |
static javax.xml.bind.JAXBContext |
getContext(String context,
ClassLoader classLoader) |
static Map<String,Object> |
getEmptyParameterMap() |
static FileInputStream |
getFileInputStream(String fileName)
Opens a file for reading and returns input stream associated with it.
|
static FileOutputStream |
getFileOutputStream(String fileName)
Opens a file for writing and returns output stream associated with it.
|
static Manifest |
getJarManifest(Class<?> klass)
Returns Manifest of a jar containing given class.
|
static <T> T |
getParameter(Object value,
T defaultValue)
Returns value if it is not null or default value if it is null.
|
static Reader |
getReader(InputStream inputStream) |
static InputStream |
getResourceStream(String name)
Finds a resource using system classloader and returns it as
input stream.
|
static Schema |
getSchema(Reader reader)
Reads a XML schema from given reader.
|
static Schema |
getSchema(Reader[] readerArray)
Reads a XML schema from given readers.
|
static Source |
getSource(Reader reader,
Schema schema) |
static Templates |
getTemplates(Reader reader)
Returns XML transform templates from given reader containing XSLT
stylesheet.
|
static Writer |
getWriter(OutputStream outputStream) |
static XMLReader |
getXmlReader() |
static XMLReader |
getXmlReader(Schema schema)
Returns XMLReader validating against given XML schema.
|
static String |
readAll(Reader reader)
Reads whole contents of a reader to a string.
|
static String |
removeBlockQuotes(String pattern)
Replaces block quotes in regular expressions with normal quotes.
|
static String |
removeCapturingGroups(String pattern)
Replaces capturing groups with non-capturing groups in the given regular
expression.
|
static void |
transform(Templates templates,
Reader reader,
Writer writer)
Performs XSLT transformation.
|
static void |
transform(Templates templates,
Reader reader,
Writer writer,
Map<String,Object> parameterMap)
Performs XSLT transformation.
|
static void |
transform(Templates templates,
Schema schema,
Reader reader,
Writer writer)
Performs XML schema validation and XSLT transformation.
|
static void |
transform(Templates templates,
Schema schema,
Reader reader,
Writer writer,
Map<String,Object> parameterMap)
Performs XML schema validation and XSLT transformation.
|
public static final int READ_BUFFER_SIZE
public static final String MANIFEST_PATH
public static Reader getReader(InputStream inputStream)
inputStream - IORuntimeException - if IO error occurspublic static Writer getWriter(OutputStream outputStream)
outputStream - IORuntimeException - if IO error occurspublic static FileInputStream getFileInputStream(String fileName)
fileName - IORuntimeException - if IO error occurspublic static FileOutputStream getFileOutputStream(String fileName)
fileName - IORuntimeException - if IO error occurspublic static InputStream getResourceStream(String name)
name - resource nameResourceNotFoundException - if resource can not be foundClassLoaderpublic static String readAll(Reader reader)
reader - IORuntimeException - on IO errorpublic static void copyAll(Reader reader, Writer writer)
reader - writer - IORuntimeException - on IO errorpublic static Manifest getJarManifest(Class<?> klass)
ResourceNotFoundException.klass - classResourceNotFoundException - if manifest was not foundpublic static XMLReader getXmlReader(Schema schema)
schema - XMLException - when SAX error occurspublic static XMLReader getXmlReader()
XMLException - when SAX error occursgetXmlReader(Schema)public static Schema getSchema(Reader reader)
reader - XMLException - when XML schema parsing error occurspublic static Schema getSchema(Reader[] readerArray)
readerArray - readers containing XML schemasXMLException - when XML schema parsing error occurspublic static Source getSource(Reader reader, Schema schema)
reader - schema - XML schemapublic static javax.xml.bind.JAXBContext getContext(String context)
context - context package nameXMLException - if JAXB error occurspublic static javax.xml.bind.JAXBContext getContext(String context, ClassLoader classLoader)
context - context package nameclassLoader - class loader used to load classes from the contextXMLException - if JAXB error occurspublic static javax.xml.bind.JAXBContext getContext(Class<?>... classesToBeBound)
classesToBeBound - XMLException - if JAXB error occurspublic static Templates getTemplates(Reader reader)
reader - XMLException - if XML parsing error occurspublic static void transform(Templates templates, Schema schema, Reader reader, Writer writer, Map<String,Object> parameterMap)
templates - XSLT stylesheetschema - XML schema to validate againstreader - reader with input documentwriter - writer which will be used to write outputparameterMap - transformation parametersXMLException - if transformation error occurspublic static void transform(Templates templates, Schema schema, Reader reader, Writer writer)
templates - XSLT stylesheetschema - XML schema to validate againstreader - reader with input documentwriter - writer which will be used to write outputXMLException - if transformation error occurspublic static void transform(Templates templates, Reader reader, Writer writer, Map<String,Object> parameterMap)
templates - XSLT stylesheetreader - reader with input documentwriter - writer which will be used to write outputparameterMap - transformation parametersXMLException - if transformation error occurspublic static void transform(Templates templates, Reader reader, Writer writer)
templates - XSLT stylesheetreader - reader with input documentwriter - writer which will be used to write outputXMLException - if transformation error occurspublic static String removeBlockQuotes(String pattern)
pattern - public static String finitize(String pattern, int infinity)
removeBlockQuotes(String).pattern - pattern to be finitizedinfinity - "n" numberpublic static Pattern compile(SrxDocument document, String regex)
public static String removeCapturingGroups(String pattern)
removeBlockQuotes(String).pattern - public static <T> T getParameter(Object value, T defaultValue)
value - objectdefaultValue - default value.ClassCastException - when value cannot be cast to default value typeCopyright © 2018. All Rights Reserved.