Java DTV API 1.3
18-Nov-2009

com.sun.dtv.broadcast
Class BroadcastStream

java.lang.Object
  extended by java.io.File
      extended by com.sun.dtv.broadcast.BroadcastStream
All Implemented Interfaces:
Serializable, Comparable

public class BroadcastStream
extends File

The BroadcastStream class represents stream obtained from broadcast file systems. An instance of BroadcastStream may be constructed from a Locator instance or via constructors similar to those of java.io.File. This also means that all these constructors use the same characters for name and path separation as other files. On the other hand the locator based constructor uses locators possibly created from URLs following the usual URL based schema where path names are separated by '/'.

Successful instantiation of a BroadcastStream object causes its broadcast stream to be dynamically "mounted" in the local filesystem. The precise mount point can be determined by calling getBroadcastFilesystem(). It should be noted that a broadcast filesystem can also be explicitly mounted using instances of BroadcastFilesystem.

Construction of a BroadcastStream object does not cause its contents to be loaded automatically from the broadcast stream. Content will be only be loaded when a FileInputStream will be created from this BroadcastStream. Subsequent attempts to read the data of a BroadcastStream object will then block until its contents are loaded.

All constructors and subsequent input or output operations must use BroadcastException to throw broadcast specific exceptions.

Broadcast file systems for which there are no remaining BroadcastStream instances or open file descriptors are eligible for unmounting from the local filesystem.

Java DTV API implementations that do not support broadcast filesystem access will throw UnsupportedOperationException upon any attempt to construct a BroadcastStream object.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
BroadcastStream(File dir, String name)
          Creates a BroadcastStream instance that represents the stream with the specified name in the specified broadcast directory.
BroadcastStream(Locator locator)
          Creates a BroadcastStream instance that represents the file referenced by the given Locator.
BroadcastStream(String path)
          Creates a BroadcastStream instance that represents the stream whose path name in the broadcast is the given path argument.
BroadcastStream(String path, String name)
          Creates a BroadcastStream instance that represents the stream with the specified name in the specified broadcast directory.
 
Method Summary
 BroadcastFilesystem getBroadcastFilesystem()
          Returns the BroadcastFileSystem this BroadcastStream belongs to.
 long getCurrentTime()
          Returns the time of the next chunk in BroadcastStream.
 long getDuration()
          Returns the duration of this BroadcastStream.
 Locator getLocator()
          Returns a Locator identifying this BroadcastStream.
 String getType()
          Retrieve the mime type of a BroadcastStream.
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BroadcastStream

public BroadcastStream(Locator locator)
                throws InvalidLocatorException,
                       IOException
Creates a BroadcastStream instance that represents the file referenced by the given Locator.

This constructor throws java.io.IOException if it determines immediately that the requested broadcast stream cannot be accessed. Since this constructor may complete its work asynchronously, absence of an IOException is not a guarantee that the requested broadcast stream is accessible.

Parameters:
locator - A Locator referencing the source of the BroadcastStream.
Throws:
InvalidLocatorException - If locator does not refer to a broadcast stream.
IOException - If the requested broadcast stream cannot be accessed or the received data is invalid.
UnsupportedOperationException - If broadcast filesystem is not supported.

BroadcastStream

public BroadcastStream(String path)
                throws IOException
Creates a BroadcastStream instance that represents the stream whose path name in the broadcast is the given path argument.

This constructor throws java.io.IOException if it determines immediately that the requested broadcast stream cannot be accessed. Since this constructor may complete its work asynchronously, absence of an IOException is not a guarantee that the requested broadcast stream is accessible.

Parameters:
path - The stream path name.
Throws:
IOException - If the requested broadcast stream cannot be accessed or the received data is invalid.
UnsupportedOperationException - If broadcast filesystem is not supported.

BroadcastStream

public BroadcastStream(File dir,
                       String name)
                throws IOException
Creates a BroadcastStream instance that represents the stream with the specified name in the specified broadcast directory.

This constructor throws java.io.IOException if it determines immediately that the requested broadcast stream cannot be accessed. Since this constructor may complete its work asynchronously, absence of an IOException is not a guarantee that the requested broadcast stream is accessible.

Parameters:
dir - The directory.
name - The stream name.
Throws:
IOException - If the requested broadcast stream cannot be accessed or the received data is invalid.
UnsupportedOperationException - If broadcast filesystem is not supported.

BroadcastStream

public BroadcastStream(String path,
                       String name)
                throws IOException
Creates a BroadcastStream instance that represents the stream with the specified name in the specified broadcast directory.

This constructor throws java.io.IOException if it determines immediately that the requested broadcast stream cannot be accessed. Since this constructor may complete its work asynchronously, absence of an IOException is not a guarantee that the requested broadcast stream is accessible.

Parameters:
path - The directory path name.
name - The stream name.
Throws:
IOException - If the requested broadcast stream cannot be accessed or the received data is invalid.
UnsupportedOperationException - If broadcast filesystem is not supported.
Method Detail

getType

public String getType()
Retrieve the mime type of a BroadcastStream.

Returns:
the mime type of the BroadcastStream, null if not available.

getDuration

public long getDuration()
Returns the duration of this BroadcastStream.

Returns:
the duration of this broadcast stream in microseconds. Returns -1 if unknown.

getCurrentTime

public long getCurrentTime()
Returns the time of the next chunk in BroadcastStream.

Returns:
the time of the next chunk in microseconds. Returns -1 if unknown.

getBroadcastFilesystem

public BroadcastFilesystem getBroadcastFilesystem()
Returns the BroadcastFileSystem this BroadcastStream belongs to.

Returns:
A BroadcastFilesystem this BroadcastStream belongs to.

getLocator

public Locator getLocator()
Returns a Locator identifying this BroadcastStream.

Returns:
A Locator identifying this BroadcastStream.

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.