public class XmlUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
advanceReaderToNext(XMLStreamReader xsr,
String tag)
Advances the Stream Reader to the next occurrence of a user-specified tag.
|
static List<Long> |
locate(List<byte[]> targets,
List<POSITION> locations,
InputStream is,
long maxOffset)
Locates specific sequences of bytes in the input stream.
|
static OffsetLength |
locate(String tag1,
TAG_TYPE tag1Type,
POSITION tag1Loc,
String tag2,
TAG_TYPE tag2Type,
POSITION tag2Loc,
long maxOffset,
InputStream is)
Deprecated.
Try using
locate(List, List, InputStream, long).
This method uses an XML parser internally, so it's 1) slower than the other method
2) it's reporting of locations is in Characters, not Bytes! |
public static List<Long> locate(List<byte[]> targets, List<POSITION> locations, InputStream is, long maxOffset) throws IOException
targets - Sequences of bytes to be searched for. The returned list will be of the same size if all
are found.is - The stream to search in, it won't be buffered, the stream will be left open
and at the position of the last occurrence of the target.maxOffset - How far down the stream to search? if maxOffset <= 0, then search
indefinitely up to Long.MAX_VALUE bytes.IOException - In case IO errors occur.@Deprecated public static OffsetLength locate(String tag1, TAG_TYPE tag1Type, POSITION tag1Loc, String tag2, TAG_TYPE tag2Type, POSITION tag2Loc, long maxOffset, InputStream is) throws FileParsingException
locate(List, List, InputStream, long).
This method uses an XML parser internally, so it's 1) slower than the other method
2) it's reporting of locations is in Characters, not Bytes!<firstTag>
and first <lastTag> tags. tag1 - The first tag after which run header startstag1Type - If the opening tag is a closing tag or an opening tagtag1Loc - If the location of the beginning of the tag must be takentag2 - The tag up to which we need to parse.tag2Type - If the last tag is an opening tag or a closing tagtag2Loc - If the location of the beginning or end of the tag entry should be takenmaxOffset - How far in the file should we look? Values <= 0 are treated as infinity.is - A stream to read from. It will be buffered internallyFileParsingException - if the tags could not be found or for any IOExceptionpublic static boolean advanceReaderToNext(XMLStreamReader xsr, String tag) throws XMLStreamException
xsr - The reader to advance.tag - The tag to advance to. No brackets, just the name.XMLStreamException - In all cases other than described by 'return'.Copyright © 2017. All rights reserved.