Class PomProjectInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class PomProjectInputStream
    extends java.io.FilterInputStream
    Filters everything in an input stream prior to the <project> element. This is useful to filter out the DOCTYPE declarations that can cause parsing issues.
    Author:
    Jeremy Long
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int BUFFER_SIZE
      The size of the buffer used to scan the input stream.
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      PomProjectInputStream​(java.io.InputStream in)
      Constructs a new POM project filtering input stream.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static int findSequence​(byte[] sequence, byte[] buffer)
      Finds the start of the given sequence in the buffer.
      • Methods inherited from class java.io.FilterInputStream

        available, close, mark, markSupported, read, read, read, reset, skip
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BUFFER_SIZE

        protected static final int BUFFER_SIZE
        The size of the buffer used to scan the input stream.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PomProjectInputStream

        public PomProjectInputStream​(java.io.InputStream in)
                              throws java.io.IOException
        Constructs a new POM project filtering input stream. The input stream is wrapped in a buffered input stream.
        Parameters:
        in - the input stream
        Throws:
        java.io.IOException - thrown if there is an I/O error
    • Method Detail

      • findSequence

        protected static int findSequence​(byte[] sequence,
                                          byte[] buffer)
        Finds the start of the given sequence in the buffer. If not found, -1 is returned.
        Parameters:
        sequence - the sequence to locate
        buffer - the buffer to search
        Returns:
        the starting position of the sequence in the buffer if found; otherwise -1