|
Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved. Specification License |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BroadcastFileConnection
BroadcastFileConnection
abstracts a broadcast connection as a file or
a directory of files. It extends the
javax.microedition.io.InputConnection
interface of
the Generic Connection Framework to provide a standard I/O interface that behaves
similar to a FileConnection.
BroadcastFileConnections
are read-only. In some broadcast implementation,
the content of the connections may be updated by the system in runtime.
A BroadcastConnectionListener
can be registered to listen for any changes to the connection. Directories will not cause events to
be sent to BroadcastConnectionListener
.
Files are referenced by URLs. URLs are formed like specified in IETF RFCs 1738 and 2396. Exact formation
of the URL is implementation and broadcast specification specific. It's possible that URLs broadcast files
have the same syntax and scheme as file URLs in JSR 75 FileConnection
API. In that case, methods getURL()
,
getPath()
and getName()
function as specified in JSR 75.
In JSR 75 the URL for a file is file://<host>/<root>/<directory>/<filename.extension>
(where .extension
) is optional and
file://<host>/<root>/<directory>/<directoryname>/
for a directory. getURL()
obviously
returns the whole URL. getName()
returns <filename>
with possible .extension
,
or <directoryname>
and getPath()
returns /root/directory/
.
Implementations may cache the broadcast files. System property javax.microedition.broadcast.supports.filecache
tells whether the implementation does that or not. The details about how and which files are cached are implementation
specific if caching is supported at all. For implementations not doing caching the application can store files considered
important into the normal file system of the implementing device.
See broadcast connection examples for some usage examples.
Method Summary | |
---|---|
long |
directorySize(boolean includeSubDirs)
Determines the size in bytes on a file system of all the available files ( isAvailable() returns true ) that
are contained in a directory. |
long |
fileSize()
Determines the size of a file on the file system. |
java.lang.String |
getName()
Returns the name of a file or directory excluding the URL scheme and all paths. |
java.lang.String |
getPath()
Returns the path name excluding the URL scheme, the name of the file or directory and the host from where the file or directory is opened. |
java.lang.String |
getURL()
Returns the URL of the file including the the URL scheme, path and the file name. |
boolean |
isDirectory()
Checks if the object is a directory. |
long |
lastModified()
Returns the time that the file is last modified. |
java.util.Enumeration |
list()
Get a list of BroadcastFileConnection s for all visible files and directories contained in a directory. |
java.util.Enumeration |
list(java.lang.String filter)
Get a list of BroadcastFileConnection s for all visible files and directories contained in a directory that
match the given filter . |
java.io.DataInputStream |
openDataInputStream()
Open and return a data input stream for a connection. |
java.io.InputStream |
openInputStream()
Open and return an input stream for a connection. |
Methods inherited from interface javax.microedition.broadcast.connection.BroadcastConnection |
---|
addListener, getMimeType, getProperties, isAvailable, removeListener |
Methods inherited from interface javax.microedition.io.Connection |
---|
close |
Method Detail |
---|
long directorySize(boolean includeSubDirs) throws java.io.IOException
isAvailable()
returns true
) that
are contained in a directory.
java.io.IOException
- if this is not a directory or the directory is unavailablelong fileSize() throws java.io.IOException
java.io.IOException
- if this is a directory or the file is unavailablejava.lang.String getName()
java.lang.String getPath()
java.lang.String getURL()
boolean isDirectory() throws java.io.IOException
true
if object is a directory, false
otherwise.
java.io.IOException
- if the file or the directory is unavailable.long lastModified() throws java.io.IOException
java.io.IOException
- if this is a directory or the file is unavailablejava.util.Enumeration list() throws java.io.IOException
BroadcastFileConnection
s for all visible files and directories contained in a directory.
Only files known will be listed. I.e. if a file carousel transmits a list of
files these should be listed. However, if a file becomes known at the moment
its transmission starts it becomes known to the client. Applications need to
add a listener to a directory to be notified of newly transmitted files if they
are not known in advance.
BroadcastFileConnection
s to all visible files and directories in a directory.
java.io.IOException
- if this is a file and not a directory or if the directory is not available.java.util.Enumeration list(java.lang.String filter) throws java.io.IOException
BroadcastFileConnection
s for all visible files and directories contained in a directory that
match the given filter
.
Only files known will be listed. I.e. if a file carousel transmits a list of
files these should be listed. However, if a file becomes known at the moment
its transmission starts it becomes known to the client. Applications need to
add a listener to a directory to be notified of newly transmitted files if they
are not known in advance.
filter
- String against which all files and directories are matched for retrieval.
An asterisk ("*") can be used as a wildcard to represent 0 or more occurrences of any character.
BroadcastFileConnection
s to all visible files and directories in a directory that match the
give filter
.
java.io.IOException
- if this is a file and not a directory or if the directory is not available.
java.lang.NullPointerException
- if filter
is null
java.lang.IllegalArgumentException
- if filter
contains path specifications,
or is an invalid file name (e.g. contains invalid characters, empty String
etc.)java.io.DataInputStream openDataInputStream() throws java.io.IOException
IOEXception
will be thrown
openDataInputStream
in interface javax.microedition.io.InputConnection
DataInputStream
to the connection.
java.io.IOException
- if the stream cannot be opened
java.lang.IllegalArgumentException
- if the connection is referring to a directoryjava.io.InputStream openInputStream() throws java.io.IOException
IOEXception
will be thrown.
If the connection is referring to a directory, an IllegalArgumentException
will be thrown.
openInputStream
in interface javax.microedition.io.InputConnection
InputStream
to the connection.
java.io.IOException
- if the stream cannot be opened
java.lang.IllegalArgumentException
- if the connection is referring to a directory
|
Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved. Specification License |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |