Class YoutubePersistentHttpStream
- java.lang.Object
-
- java.io.InputStream
-
- com.sedmelluq.discord.lavaplayer.tools.io.SeekableInputStream
-
- com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream
-
- com.sedmelluq.discord.lavaplayer.source.youtube.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.
-
-
Field Summary
-
Fields inherited from class com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream
contentUrl, currentContent, httpInterface, position
-
Fields inherited from class com.sedmelluq.discord.lavaplayer.tools.io.SeekableInputStream
contentLength
-
-
Constructor Summary
Constructors Constructor Description YoutubePersistentHttpStream(HttpInterface httpInterface, java.net.URI contentUrl, long contentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSeekHard()protected java.net.URIgetConnectUrl()protected intinternalRead(byte[] b, int off, int len, boolean attemptReconnect)protected longinternalSkip(long n, boolean attemptReconnect)protected booleanuseHeadersForRange()-
Methods inherited from class com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream
available, checkStatusCode, close, connect, createContentInputStream, getCurrentResponse, getPosition, getTrackInfoProviders, markSupported, read, read, releaseConnection, reset, seekHard, skip
-
Methods inherited from class com.sedmelluq.discord.lavaplayer.tools.io.SeekableInputStream
getContentLength, getMaxSkipDistance, seek, skipFully
-
-
-
-
Constructor Detail
-
YoutubePersistentHttpStream
public YoutubePersistentHttpStream(HttpInterface httpInterface, java.net.URI contentUrl, long contentLength)
- Parameters:
httpInterface- The HTTP interface to use for requestscontentUrl- The URL of the resourcecontentLength- The length of the resource in bytes
-
-
Method Detail
-
getConnectUrl
protected java.net.URI getConnectUrl()
- Overrides:
getConnectUrlin classPersistentHttpStream
-
internalRead
protected int internalRead(byte[] b, int off, int len, boolean attemptReconnect) throws java.io.IOException- Overrides:
internalReadin classPersistentHttpStream- Throws:
java.io.IOException
-
internalSkip
protected long internalSkip(long n, boolean attemptReconnect) throws java.io.IOException- Overrides:
internalSkipin classPersistentHttpStream- Throws:
java.io.IOException
-
useHeadersForRange
protected boolean useHeadersForRange()
- Overrides:
useHeadersForRangein classPersistentHttpStream
-
canSeekHard
public boolean canSeekHard()
- Overrides:
canSeekHardin classPersistentHttpStream- Returns:
trueif it is possible to seek to an arbitrary position in this stream, even when it is behind the current position.
-
-