public abstract class ConnectionHolder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
ConnectionHolder.FileConnectionHolder |
private static class |
ConnectionHolder.MemoryConnectionHolder |
private static class |
ConnectionHolder.URIConnectionHolder |
Modifier and Type | Field and Description |
---|---|
(package private) java.nio.ByteBuffer |
buffer |
(package private) java.nio.channels.ReadableByteChannel |
channel |
private static int |
DEFAULT_BUFFER_SIZE |
Constructor and Description |
---|
ConnectionHolder() |
Modifier and Type | Method and Description |
---|---|
void |
closeConnection()
Closes connection when done.
|
(package private) static ConnectionHolder |
createFileConnectionHolder(java.net.URI uri) |
(package private) static ConnectionHolder |
createHLSConnectionHolder(java.net.URI uri) |
(package private) static ConnectionHolder |
createMemoryConnectionHolder(java.nio.ByteBuffer buffer) |
(package private) static ConnectionHolder |
createURIConnectionHolder(java.net.URI uri,
java.util.Map<java.lang.String,java.lang.Object> connectionProperties) |
java.nio.ByteBuffer |
getBuffer() |
(package private) int |
getStreamSize()
Get stream size.
|
(package private) abstract boolean |
isRandomAccess()
Detects whether the source is a random access source.
|
(package private) abstract boolean |
isSeekable()
Detects whether the source is seekable.
|
(package private) abstract boolean |
needBuffer()
Detects whether this source needs buffering at the pipeline level.
|
(package private) int |
property(int prop,
int value)
Get or set properties.
|
(package private) abstract int |
readBlock(long position,
int size)
Reads a block of data from the arbitrary position of the opened stream.
|
int |
readNextBlock()
Reads a block of data from the current position of the opened stream.
|
abstract long |
seek(long position)
Performs a seek request to the desired position.
|
private static int DEFAULT_BUFFER_SIZE
java.nio.channels.ReadableByteChannel channel
java.nio.ByteBuffer buffer
static ConnectionHolder createMemoryConnectionHolder(java.nio.ByteBuffer buffer)
static ConnectionHolder createURIConnectionHolder(java.net.URI uri, java.util.Map<java.lang.String,java.lang.Object> connectionProperties) throws java.io.IOException
java.io.IOException
static ConnectionHolder createFileConnectionHolder(java.net.URI uri) throws java.io.IOException
java.io.IOException
static ConnectionHolder createHLSConnectionHolder(java.net.URI uri) throws java.io.IOException
java.io.IOException
public int readNextBlock() throws java.io.IOException
java.nio.channels.ClosedChannelException
- if an attempt is made to read after
closeConnection has been calledjava.io.IOException
public java.nio.ByteBuffer getBuffer()
abstract int readBlock(long position, int size) throws java.io.IOException
java.nio.channels.ClosedChannelException
- if an attempt is made to read after
closeConnection has been calledjava.io.IOException
abstract boolean needBuffer()
abstract boolean isSeekable()
abstract boolean isRandomAccess()
public abstract long seek(long position)
public void closeConnection()
int property(int prop, int value)
prop
- - Property ID.value
- - Depends on property ID.int getStreamSize()