J2ME CDC

javax.microedition.io
Interface DirectoryConnection

All Superinterfaces:
Connection, DataInput, DataOutput, InputConnection, OutputConnection, RandomAccessConnection

public interface DirectoryConnection
extends RandomAccessConnection

Metadata connection


Method Summary
 boolean canRead()
          Test to see if the selected item can be read
 boolean canWrite()
          Test to see if the selected item can be written
 void create()
          Create a data item in the collection with a randomly chosen unique name and select it
 void create(int i)
          Create an item with the supplied number
 void create(String name)
          Create a data item with the supplied name and select it
 void createDirectory(String name)
          Create a directory with the supplied name
 void delete()
          Delete the current data item from the collection
 void deleteDirectory()
          Delete a directory
 void deselectItem()
          Unselect the current item.
 long getAvailableSpace()
          Return the size in bytes that the collection can grow to
 int getItemCount()
          Return the number of items in the collection
 String getItemName()
          Return the number of the current record
 int getItemNumber()
          Return the number of the current item
 long getModificationDate()
          Return the date that the item was last modified
 boolean isDirectory()
          Test to see if the current item is a directory
 void rename(String newName)
          Rename the current data item
 void renameDirectory(String to)
          Rename a directory with the supplied name
 boolean selectFirstItem()
          Select the first record int the database
 boolean selectItem(int i)
          Select an item in the collection
 boolean selectItem(String name)
          Select an item in the collection
 boolean selectNextItem()
          Select the next record int the database
 void setReadable(boolean tf)
          Set or clear the read bit
 void setWritable(boolean tf)
          Set or clear the write bit
 
Methods inherited from interface javax.microedition.io.RandomAccessConnection
getLength, getPosition, isSelected, read, read, seek, setLength, write, write
 
Methods inherited from interface javax.microedition.io.InputConnection
openDataInputStream, openInputStream
 
Methods inherited from interface javax.microedition.io.Connection
close
 
Methods inherited from interface javax.microedition.io.OutputConnection
openDataOutputStream, openOutputStream
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from interface java.io.DataOutput
write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 

Method Detail

getAvailableSpace

public long getAvailableSpace()
                       throws IOException
Return the size in bytes that the collection can grow to
Returns:
size

getItemCount

public int getItemCount()
                 throws IOException
Return the number of items in the collection
Returns:
size

selectFirstItem

public boolean selectFirstItem()
                        throws IOException
Select the first record int the database
Returns:
true if there was a record false if the collection was empty
Throws:
IOException - if an I/O error occurs.

selectNextItem

public boolean selectNextItem()
                       throws IOException
Select the next record int the database
Returns:
true if there was another record false otherwise
Throws:
IOException - if an I/O error occurs.

selectItem

public boolean selectItem(String name)
                   throws IOException
Select an item in the collection
Parameters:
name - the name of the item to select
Returns:
true if the record exists
Throws:
IOException - if an I/O error occurs.

selectItem

public boolean selectItem(int i)
                   throws IOException
Select an item in the collection
Parameters:
i - the record number
Returns:
true if the record exists
Throws:
IOException - if an I/O error occurs.

deselectItem

public void deselectItem()
                  throws IOException
Unselect the current item. This is a way to unlock a record without locking another one.
Throws:
IOException - if an I/O error occurs.

isDirectory

public boolean isDirectory()
                    throws IOException
Test to see if the current item is a directory
Returns:
true if it is, false if it is not

create

public void create()
            throws IOException
Create a data item in the collection with a randomly chosen unique name and select it
Throws:
IOException - if an I/O error occurs.

create

public void create(String name)
            throws IOException
Create a data item with the supplied name and select it
Parameters:
name - the name of the item to create
Throws:
IOException - if an I/O error occurs.

create

public void create(int i)
            throws IOException
Create an item with the supplied number
Parameters:
i - the record number
Throws:
IOException - if an I/O error occurs.

createDirectory

public void createDirectory(String name)
                     throws IOException
Create a directory with the supplied name
Parameters:
name - the name of the directory to create
Throws:
IOException - if an I/O error occurs.

delete

public void delete()
            throws IOException
Delete the current data item from the collection
Throws:
IOException - if an I/O error occurs.

deleteDirectory

public void deleteDirectory()
                     throws IOException
Delete a directory
Throws:
IOException - if an I/O error occurs.

rename

public void rename(String newName)
            throws IOException
Rename the current data item
Parameters:
name - the new name for the item
Throws:
IOException - if an I/O error occurs.

renameDirectory

public void renameDirectory(String to)
                     throws IOException
Rename a directory with the supplied name
Parameters:
to - the new name for the directory
Throws:
IOException - if an I/O error occurs.

getItemName

public String getItemName()
                   throws IOException
Return the number of the current record
Returns:
the name of the item or null if no item is selected
Throws:
IOException - if an I/O error occurs.

getItemNumber

public int getItemNumber()
                  throws IOException
Return the number of the current item
Returns:
the current item number
Throws:
IOException - if an I/O error occurs.

getModificationDate

public long getModificationDate()
                         throws IOException
Return the date that the item was last modified
Returns:
date or -1 if the record was undated.
Throws:
IOException - if an I/O error occurs.

canRead

public boolean canRead()
                throws IOException
Test to see if the selected item can be read
Returns:
true if the item can be read, else false.
Throws:
IOException - if an I/O error occurs.

setReadable

public void setReadable(boolean tf)
                 throws IOException
Set or clear the read bit
Parameters:
tf - the new value for the read bit
Throws:
IOException - if an I/O error occurs.

canWrite

public boolean canWrite()
                 throws IOException
Test to see if the selected item can be written
Returns:
true if the item can be written, else false.
Throws:
IOException - if an I/O error occurs.

setWritable

public void setWritable(boolean tf)
                 throws IOException
Set or clear the write bit
Parameters:
tf - the new value for the write bit
Throws:
IOException - if an I/O error occurs.

J2ME CDC

Java is a trademark or registred trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo, Alto, California, 94303, U.S.A All Rights Reserved.