Package com._1c.g5.v8.dt.xml
Class XmlStreamUtils
- java.lang.Object
-
- com._1c.g5.v8.dt.xml.XmlStreamUtils
-
public class XmlStreamUtils extends Object
Utilities for working with xml streams
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OutputStream
createEmptyLastLineOutputStream(OutputStream outputStream)
Create custom implementation ofFilterOutputStream
which adds an empty line (if there was none) when closing the streamstatic OutputStream
createOsLineSeporatorOutputStream(OutputStream outputStream)
static byte[]
readHeadExcludeVersion(InputStream inputStream, byte[] tag)
Read input stream until the specified xml tag ends, return byte array of read data without "version" attribute from given tag.static byte[]
readHeadExcludeVersion(InputStream inputStream, byte[] tag, int limit)
Read input stream until the specified xml tag ends, return byte array of read data without "version" attribute from given tag.static byte[]
readHeadIncludeVersion(InputStream inputStream, byte[] tag, String xmlFormatVersion)
Read input stream until the specified xml tag ends, return byte array of read data with "version" attribute at the end of given tag.static byte[]
readHeadIncludeVersion(InputStream inputStream, byte[] tag, String xmlFormatVersion, int limit)
Read input stream until the specified xml tag ends, return byte array of read data with "version" attribute at the end of given tag.static void
skipElement(InputStream inputStream, byte[] tag)
Read input stream until the specified xml tag ends
-
-
-
Method Detail
-
readHeadExcludeVersion
public static byte[] readHeadExcludeVersion(InputStream inputStream, byte[] tag) throws IllegalArgumentException, IOException
Read input stream until the specified xml tag ends, return byte array of read data without "version" attribute from given tag.- Parameters:
inputStream
- the underlying input stream, cannot benull
tag
- byte array presentation of xml tag, cannot benull
- Returns:
- return byte array of read data without "version" attribute from given tag, never
null
- Throws:
IllegalArgumentException
- if no match is found before the read default buffer overflows occurs.IOException
- if an I/O error occurs.
-
readHeadExcludeVersion
public static byte[] readHeadExcludeVersion(InputStream inputStream, byte[] tag, int limit) throws IllegalArgumentException, IOException
Read input stream until the specified xml tag ends, return byte array of read data without "version" attribute from given tag.- Parameters:
inputStream
- the underlying input stream, cannot benull
tag
- byte array presentation of xml tag, cannot benull
limit
- the buffer read limit- Returns:
- return byte array of read data without "version" attribute from given tag, never
null
- Throws:
IllegalArgumentException
- if no match is found before the read default buffer overflows occurs.IOException
- if an I/O error occurs.
-
readHeadIncludeVersion
public static byte[] readHeadIncludeVersion(InputStream inputStream, byte[] tag, String xmlFormatVersion) throws IllegalArgumentException, IOException
Read input stream until the specified xml tag ends, return byte array of read data with "version" attribute at the end of given tag.- Parameters:
inputStream
- the underlying input stream, cannot benull
tag
- byte array presentation of xml tag, cannot benull
xmlFormatVersion
- the string presentation of xml format version, cannot benull
- Returns:
- return byte array of read data with "version" attribute for given tag, never
null
- Throws:
IllegalArgumentException
- if no match is found before the read default buffer overflows occurs.IOException
- if an I/O error occurs.
-
readHeadIncludeVersion
public static byte[] readHeadIncludeVersion(InputStream inputStream, byte[] tag, String xmlFormatVersion, int limit) throws IllegalArgumentException, IOException
Read input stream until the specified xml tag ends, return byte array of read data with "version" attribute at the end of given tag.- Parameters:
inputStream
- the underlying input stream, cannot benull
tag
- byte array presentation of xml tag, cannot benull
xmlFormatVersion
- the string presentation of xml format version, cannot benull
limit
- the buffer read limit- Returns:
- return byte array of read data with "version" attribute for given tag, never
null
- Throws:
IllegalArgumentException
- if no match is found before the read default buffer overflows occurs.IOException
- if an I/O error occurs.
-
skipElement
public static void skipElement(InputStream inputStream, byte[] tag) throws IllegalArgumentException, IOException
Read input stream until the specified xml tag ends- Parameters:
inputStream
- the underlying input stream, cannot benull
tag
- byte array presentation of xml tag, cannot benull
- Throws:
IllegalArgumentException
- if no match is found before the read default buffer overflows occurs.IOException
- if an I/O error occurs.
-
createEmptyLastLineOutputStream
public static OutputStream createEmptyLastLineOutputStream(OutputStream outputStream)
Create custom implementation ofFilterOutputStream
which adds an empty line (if there was none) when closing the stream- Parameters:
outputStream
- the underlying output stream, cannot benull
- Returns:
- custom output stream, nevet
null
-
createOsLineSeporatorOutputStream
public static OutputStream createOsLineSeporatorOutputStream(OutputStream outputStream)
-
-