Class SeekableInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.sedmelluq.discord.lavaplayer.tools.io.SeekableInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
LocalSeekableInputStream,NonSeekableInputStream,PersistentHttpStream,SavedHeadSeekableInputStream
public abstract class SeekableInputStream extends java.io.InputStreamAn input stream that is seekable.
-
-
Field Summary
Fields Modifier and Type Field Description protected longcontentLength
-
Constructor Summary
Constructors Constructor Description SeekableInputStream(long contentLength, long maxSkipDistance)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleancanSeekHard()longgetContentLength()longgetMaxSkipDistance()abstract longgetPosition()abstract java.util.List<AudioTrackInfoProvider>getTrackInfoProviders()voidseek(long position)Seek to the specified positionprotected abstract voidseekHard(long position)voidskipFully(long distance)Skip the specified number of bytes in the stream.
-
-
-
Method Detail
-
getContentLength
public long getContentLength()
- Returns:
- Length of the stream
-
getMaxSkipDistance
public long getMaxSkipDistance()
- Returns:
- Maximum distance that this stream will skip without doing a direct seek on the underlying resource.
-
getPosition
public abstract long getPosition()
- Returns:
- Current position in the stream
-
seekHard
protected abstract void seekHard(long position) throws java.io.IOException- Throws:
java.io.IOException
-
canSeekHard
public abstract boolean canSeekHard()
- Returns:
trueif it is possible to seek to an arbitrary position in this stream, even when it is behind the current position.
-
skipFully
public void skipFully(long distance) throws java.io.IOExceptionSkip the specified number of bytes in the stream. The result is either that the requested number of bytes were skipped or an EOFException was thrown.- Parameters:
distance- The number of bytes to skip- Throws:
java.io.IOException- On IO error
-
seek
public void seek(long position) throws java.io.IOExceptionSeek to the specified position- Parameters:
position- The position to seek to- Throws:
java.io.IOException- On a read error or if the position is beyond EOF
-
getTrackInfoProviders
public abstract java.util.List<AudioTrackInfoProvider> getTrackInfoProviders()
-
-