Class ConstrainableInputStream

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

    @Deprecated
    public final class ConstrainableInputStream
    extends java.io.BufferedInputStream
    Deprecated.
    use ControllableInputStream instead (but don't use that either, because this is jsoup internal!)
    A jsoup internal class (so don't use it as there is no contract API) that enables constraints on an Input Stream, namely a maximum read size, and the ability to Thread.interrupt() the read.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean capped
      Deprecated.
       
      private boolean interrupted
      Deprecated.
       
      private int maxSize
      Deprecated.
       
      private int remaining
      Deprecated.
       
      private long startTime
      Deprecated.
       
      private long timeout
      Deprecated.
       
      • Fields inherited from class java.io.BufferedInputStream

        buf, count, marklimit, markpos, pos
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ConstrainableInputStream​(java.io.InputStream in, int bufferSize, int maxSize)
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private boolean expired()
      Deprecated.
       
      int read​(byte[] b, int off, int len)
      Deprecated.
       
      java.nio.ByteBuffer readToByteBuffer​(int max)
      Deprecated.
      Reads this inputstream to a ByteBuffer.
      void reset()
      Deprecated.
       
      ConstrainableInputStream timeout​(long startTimeNanos, long timeoutMillis)
      Deprecated.
       
      static ConstrainableInputStream wrap​(java.io.InputStream in, int bufferSize, int maxSize)
      Deprecated.
      If this InputStream is not already a ConstrainableInputStream, let it be one.
      • Methods inherited from class java.io.BufferedInputStream

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

        read
      • 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

      • capped

        private final boolean capped
        Deprecated.
      • maxSize

        private final int maxSize
        Deprecated.
      • startTime

        private long startTime
        Deprecated.
      • timeout

        private long timeout
        Deprecated.
      • remaining

        private int remaining
        Deprecated.
      • interrupted

        private boolean interrupted
        Deprecated.
    • Constructor Detail

      • ConstrainableInputStream

        private ConstrainableInputStream​(java.io.InputStream in,
                                         int bufferSize,
                                         int maxSize)
        Deprecated.
    • Method Detail

      • wrap

        public static ConstrainableInputStream wrap​(java.io.InputStream in,
                                                    int bufferSize,
                                                    int maxSize)
        Deprecated.
        If this InputStream is not already a ConstrainableInputStream, let it be one.
        Parameters:
        in - the input stream to (maybe) wrap
        bufferSize - the buffer size to use when reading
        maxSize - the maximum size to allow to be read. 0 == infinite.
        Returns:
        a constrainable input stream
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Deprecated.
        Overrides:
        read in class java.io.BufferedInputStream
        Throws:
        java.io.IOException
      • readToByteBuffer

        public java.nio.ByteBuffer readToByteBuffer​(int max)
                                             throws java.io.IOException
        Deprecated.
        Reads this inputstream to a ByteBuffer. The supplied max may be less than the inputstream's max, to support reading just the first bytes.
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Deprecated.
        Overrides:
        reset in class java.io.BufferedInputStream
        Throws:
        java.io.IOException
      • expired

        private boolean expired()
        Deprecated.