Class YoutubePersistentHttpStream

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

    public class YoutubePersistentHttpStream
    extends PersistentHttpStream
    A persistent HTTP stream implementation that uses the range parameter instead of HTTP headers for specifying the start position at which to start reading on a new connection.
    • Constructor Detail

      • YoutubePersistentHttpStream

        public YoutubePersistentHttpStream​(HttpInterface httpInterface,
                                           java.net.URI contentUrl,
                                           long contentLength)
        Parameters:
        httpInterface - The HTTP interface to use for requests
        contentUrl - The URL of the resource
        contentLength - The length of the resource in bytes
    • Method Detail

      • internalRead

        protected int internalRead​(byte[] b,
                                   int off,
                                   int len,
                                   boolean attemptReconnect)
                            throws java.io.IOException
        Overrides:
        internalRead in class PersistentHttpStream
        Throws:
        java.io.IOException
      • internalSkip

        protected long internalSkip​(long n,
                                    boolean attemptReconnect)
                             throws java.io.IOException
        Overrides:
        internalSkip in class PersistentHttpStream
        Throws:
        java.io.IOException
      • canSeekHard

        public boolean canSeekHard()
        Overrides:
        canSeekHard in class PersistentHttpStream
        Returns:
        true if it is possible to seek to an arbitrary position in this stream, even when it is behind the current position.