Top Description Inners Fields Constructors Methods
com.sun.media.jfxmedia.locator

public abstract Class ConnectionHolder

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.media.jfxmedia.locator.ConnectionHolder.FileConnectionHolder, com.sun.media.jfxmedia.locator.ConnectionHolder.URIConnectionHolder, com.sun.media.jfxmedia.locator.ConnectionHolder.MemoryConnectionHolder, com.sun.media.jfxmedia.locator.HLSConnectionHolder
Imports
java.io.File, .IOException, .InputStream, .RandomAccessFile, java.net.HttpURLConnection, .JarURLConnection, .URI, .URLConnection, java.nio.ByteBuffer, java.nio.channels.Channels, .ClosedChannelException, .FileChannel, .ReadableByteChannel, java.util.Map

Connection holders hold and maintain connection do different kinds of sources

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv ByteBuffer
pack-priv ReadableByteChannel
private static int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
closeConnection()

Closes connection when done.

pack-priv static ConnectionHolder
pack-priv static ConnectionHolder
pack-priv static ConnectionHolder
pack-priv static ConnectionHolder
createURIConnectionHolder(URI uri, Map<String, Object> connectionProperties)

public ConnectionHolder
getAudioStream()

Returns ConnectionHolder for additional audio stream if any.

public ByteBuffer
pack-priv abstract boolean

Returns:

true is the source is random access, false otherwise.
isRandomAccess
()

Detects whether the source is a random access source.

pack-priv abstract boolean

Returns:

true if the source is seekable, false otherwise.
isSeekable
()

Detects whether the source is seekable.

pack-priv abstract boolean

Returns:

true if the source needs a buffer, false otherwise.
needBuffer
()

Detects whether this source needs buffering at the pipeline level.

pack-priv int

Returns:

- Depends on property ID.
property
(int
- Property ID.
prop
,
int
- Depends on property ID.
value
)

Get or set properties.

pack-priv abstract int

Returns:

The number of bytes read, possibly zero, or -1 if the given position is greater than or equal to the file's current size.
readBlock
(long position, int size)

Reads a block of data from the arbitrary position of the opened stream.

public int

Returns:

The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream.
readNextBlock
()

Reads a block of data from the current position of the opened stream.

public abstract long

Returns:

-1 if the seek request failed or new stream position
seek
(long position)

Performs a seek request to the desired position.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
pack-priv ByteBuffer buffer
channelback to summary
pack-priv ReadableByteChannel channel
DEFAULT_BUFFER_SIZEback to summary
private static int DEFAULT_BUFFER_SIZE

Constructor Detail

ConnectionHolderback to summary
public ConnectionHolder()

Method Detail

closeConnectionback to summary
public void closeConnection()

Closes connection when done. Overriding methods should call this method in the beginning of their implementation.

createFileConnectionHolderback to summary
pack-priv static ConnectionHolder createFileConnectionHolder(URI uri) throws IOException
createHLSConnectionHolderback to summary
pack-priv static ConnectionHolder createHLSConnectionHolder(URI uri)
createMemoryConnectionHolderback to summary
pack-priv static ConnectionHolder createMemoryConnectionHolder(ByteBuffer buffer)
createURIConnectionHolderback to summary
pack-priv static ConnectionHolder createURIConnectionHolder(URI uri, Map<String, Object> connectionProperties) throws IOException
getAudioStreamback to summary
public ConnectionHolder getAudioStream()

Returns ConnectionHolder for additional audio stream if any. Currently used by HLS with EXT-X-MEDIA tag.

getBufferback to summary
public ByteBuffer getBuffer()
isRandomAccessback to summary
pack-priv abstract boolean isRandomAccess()

Detects whether the source is a random access source. If the method returns true then the source is capable of working in pull mode. To be able to work in pull mode holder must provide implementation.

Returns:boolean

true is the source is random access, false otherwise.

isSeekableback to summary
pack-priv abstract boolean isSeekable()

Detects whether the source is seekable.

Returns:boolean

true if the source is seekable, false otherwise.

needBufferback to summary
pack-priv abstract boolean needBuffer()

Detects whether this source needs buffering at the pipeline level. When true the pipeline contains progressbuffer after the source.

Returns:boolean

true if the source needs a buffer, false otherwise.

propertyback to summary
pack-priv int property(int prop, int value)

Get or set properties.

Parameters
prop:int

- Property ID.

value:int

- Depends on property ID.

Returns:int

- Depends on property ID.

readBlockback to summary
pack-priv abstract int readBlock(long position, int size) throws IOException

Reads a block of data from the arbitrary position of the opened stream.

Returns:int

The number of bytes read, possibly zero, or -1 if the given position is greater than or equal to the file's current size.

Exceptions
ClosedChannelException:
if an attempt is made to read after closeConnection has been called
readNextBlockback to summary
public int readNextBlock() throws IOException

Reads a block of data from the current position of the opened stream.

Returns:int

The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream.

Exceptions
ClosedChannelException:
if an attempt is made to read after closeConnection has been called
seekback to summary
public abstract long seek(long position)

Performs a seek request to the desired position.

Returns:long

-1 if the seek request failed or new stream position

com.sun.media.jfxmedia.locator back to summary

private Class ConnectionHolder.FileConnectionHolder

extends ConnectionHolder
Class Inheritance

Field Summary

Modifier and TypeField and Description
private RandomAccessFile
Inherited from com.sun.media.jfxmedia.locator.ConnectionHolder:
bufferchannel

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv boolean
isRandomAccess()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Detects whether the source is a random access source.

pack-priv boolean
isSeekable()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Detects whether the source is seekable.

pack-priv boolean
needBuffer()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Detects whether this source needs buffering at the pipeline level.

private ReadableByteChannel
openFile(final URI uri)

pack-priv int
readBlock(long position, int size)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Reads a block of data from the arbitrary position of the opened stream.

public long
seek(long position)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Performs a seek request to the desired position.

Inherited from com.sun.media.jfxmedia.locator.ConnectionHolder:
createFileConnectionHoldercreateHLSConnectionHoldercreateMemoryConnectionHoldercreateURIConnectionHoldergetAudioStreamgetBufferpropertyreadNextBlock

Field Detail

fileback to summary
private RandomAccessFile file

Constructor Detail

FileConnectionHolderback to summary
pack-priv FileConnectionHolder(URI uri) throws IOException

Method Detail

closeConnectionback to summary
public void closeConnection()

Overrides com.sun.media.jfxmedia.locator.ConnectionHolder.closeConnection.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.closeConnection.

Closes connection when done. Overriding methods should call this method in the beginning of their implementation.

Annotations
@Override
isRandomAccessback to summary
pack-priv boolean isRandomAccess()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Detects whether the source is a random access source. If the method returns true then the source is capable of working in pull mode. To be able to work in pull mode holder must provide implementation.

Annotations
@Override
isSeekableback to summary
pack-priv boolean isSeekable()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Detects whether the source is seekable.

Annotations
@Override
needBufferback to summary
pack-priv boolean needBuffer()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Detects whether this source needs buffering at the pipeline level. When true the pipeline contains progressbuffer after the source.

Annotations
@Override
openFileback to summary
private ReadableByteChannel openFile(final URI uri) throws IOException
readBlockback to summary
pack-priv int readBlock(long position, int size) throws IOException

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Reads a block of data from the arbitrary position of the opened stream.

Annotations
@Override
seekback to summary
public long seek(long position)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Performs a seek request to the desired position.

Annotations
@Override
com.sun.media.jfxmedia.locator back to summary

private Class ConnectionHolder.MemoryConnectionHolder

extends ConnectionHolder
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
Inherited from com.sun.media.jfxmedia.locator.ConnectionHolder:
bufferchannel

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv boolean
isRandomAccess()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Detects whether the source is a random access source.

pack-priv boolean
isSeekable()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Detects whether the source is seekable.

pack-priv boolean
needBuffer()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Detects whether this source needs buffering at the pipeline level.

pack-priv int
readBlock(long position, int size)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Reads a block of data from the arbitrary position of the opened stream.

public long
seek(long position)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Performs a seek request to the desired position.

Inherited from com.sun.media.jfxmedia.locator.ConnectionHolder:
createFileConnectionHoldercreateHLSConnectionHoldercreateMemoryConnectionHoldercreateURIConnectionHoldergetAudioStreamgetBufferpropertyreadNextBlock

Field Detail

backingBufferback to summary
private final ByteBuffer backingBuffer

Constructor Detail

MemoryConnectionHolderback to summary
public MemoryConnectionHolder(ByteBuffer buf)

Method Detail

closeConnectionback to summary
public void closeConnection()

Overrides com.sun.media.jfxmedia.locator.ConnectionHolder.closeConnection.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.closeConnection.

Closes connection when done. Overriding methods should call this method in the beginning of their implementation.

Annotations
@Override
isRandomAccessback to summary
pack-priv boolean isRandomAccess()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Detects whether the source is a random access source. If the method returns true then the source is capable of working in pull mode. To be able to work in pull mode holder must provide implementation.

Annotations
@Override
isSeekableback to summary
pack-priv boolean isSeekable()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Detects whether the source is seekable.

Annotations
@Override
needBufferback to summary
pack-priv boolean needBuffer()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Detects whether this source needs buffering at the pipeline level. When true the pipeline contains progressbuffer after the source.

Annotations
@Override
readBlockback to summary
pack-priv int readBlock(long position, int size) throws IOException

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Reads a block of data from the arbitrary position of the opened stream.

Annotations
@Override
seekback to summary
public long seek(long position)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Performs a seek request to the desired position.

Annotations
@Override
com.sun.media.jfxmedia.locator back to summary

private Class ConnectionHolder.URIConnectionHolder

extends ConnectionHolder
Class Inheritance

Field Summary

Modifier and TypeField and Description
private URI
private URLConnection
Inherited from com.sun.media.jfxmedia.locator.ConnectionHolder:
bufferchannel

Constructor Summary

AccessConstructor and Description
pack-priv
URIConnectionHolder(URI uri, Map<String, Object> connectionProperties)

Method Summary

Modifier and TypeMethod and Description
public void
private boolean
pack-priv boolean
isRandomAccess()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Detects whether the source is a random access source.

private boolean
pack-priv boolean
isSeekable()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Detects whether the source is seekable.

pack-priv boolean
needBuffer()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Detects whether this source needs buffering at the pipeline level.

private ReadableByteChannel
openChannel(InputStream inputStream)

pack-priv int
readBlock(long position, int size)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Reads a block of data from the arbitrary position of the opened stream.

public long
seek(long position)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Performs a seek request to the desired position.

Inherited from com.sun.media.jfxmedia.locator.ConnectionHolder:
createFileConnectionHoldercreateHLSConnectionHoldercreateMemoryConnectionHoldercreateURIConnectionHoldergetAudioStreamgetBufferpropertyreadNextBlock

Field Detail

uriback to summary
private URI uri
urlConnectionback to summary
private URLConnection urlConnection

Constructor Detail

URIConnectionHolderback to summary
pack-priv URIConnectionHolder(URI uri, Map<String, Object> connectionProperties) throws IOException

Method Detail

closeConnectionback to summary
public void closeConnection()

Overrides com.sun.media.jfxmedia.locator.ConnectionHolder.closeConnection.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.closeConnection.

Closes connection when done. Overriding methods should call this method in the beginning of their implementation.

Annotations
@Override
isJRTback to summary
private boolean isJRT()
isRandomAccessback to summary
pack-priv boolean isRandomAccess()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.isRandomAccess.

Detects whether the source is a random access source. If the method returns true then the source is capable of working in pull mode. To be able to work in pull mode holder must provide implementation.

Annotations
@Override
isResourceback to summary
private boolean isResource()
isSeekableback to summary
pack-priv boolean isSeekable()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.isSeekable.

Detects whether the source is seekable.

Annotations
@Override
needBufferback to summary
pack-priv boolean needBuffer()

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.needBuffer.

Detects whether this source needs buffering at the pipeline level. When true the pipeline contains progressbuffer after the source.

Annotations
@Override
openChannelback to summary
private ReadableByteChannel openChannel(InputStream inputStream) throws IOException
readBlockback to summary
pack-priv int readBlock(long position, int size) throws IOException

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.readBlock.

Reads a block of data from the arbitrary position of the opened stream.

Annotations
@Override
seekback to summary
public long seek(long position)

Implements abstract com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Doc from com.sun.media.jfxmedia.locator.ConnectionHolder.seek.

Performs a seek request to the desired position.

Annotations
@Override