net.sf.bt747.j2se.system
Class J2SEFile

java.lang.Object
  extended by net.sf.bt747.j2se.system.J2SEFile
All Implemented Interfaces:
BT747File, BT747InputStream, BT747OutputStream

public final class J2SEFile
extends java.lang.Object
implements BT747File

Implement the system interface of BT747File.

Author:
Mario De Weerd

Constructor Summary
J2SEFile(java.lang.String path)
          Initializer called by the Interface.
J2SEFile(java.lang.String path, int mode)
          Initializer called by the Interface.
 
Method Summary
 boolean close()
          Close the file.
 boolean createDir()
          Creates a directory.
 boolean delete()
          Deletes the file
 boolean exists()
          Determine if the file exists.
static java.lang.String getCardVolumePath()
           
 int getLastError()
          Error number of the last error that occurred.
 int getModificationTime()
          Get modification time (UTC)
 java.lang.String getPath()
          Get the file's path.
 int getSize()
          Get the current file size.
 boolean isOpen()
          Determine if the file handle is open.
 int readBytes(byte[] b, int off, int len)
          Read bytes from file to buffer.
 int writeBytes(byte[] b, int off, int len)
          Write bytes from byte buffer to file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2SEFile

public J2SEFile(java.lang.String path)
Initializer called by the Interface.

Parameters:
path - The path to the file to operate on.

J2SEFile

public J2SEFile(java.lang.String path,
                int mode)
Initializer called by the Interface.

Parameters:
path - The path to the file to operate on.
mode - The way the file should be opened.
Method Detail

getSize

public int getSize()
Description copied from interface: BT747File
Get the current file size.

Specified by:
getSize in interface BT747File
Returns:
File size.

exists

public boolean exists()
Description copied from interface: BT747File
Determine if the file exists.

Specified by:
exists in interface BT747File
Returns:
true when the file exists.

delete

public boolean delete()
Description copied from interface: BT747File
Deletes the file

Specified by:
delete in interface BT747File
Returns:
true if success.

createDir

public boolean createDir()
Description copied from interface: BT747File
Creates a directory.

Specified by:
createDir in interface BT747File
Returns:
true if success.

close

public boolean close()
Description copied from interface: BT747File
Close the file.

Specified by:
close in interface BT747File
Returns:
true if success.

getLastError

public int getLastError()
Description copied from interface: BT747File
Error number of the last error that occurred.

Specified by:
getLastError in interface BT747File
Returns:
The last error type.

isOpen

public boolean isOpen()
Description copied from interface: BT747File
Determine if the file handle is open.

Specified by:
isOpen in interface BT747File
Returns:
true when open.

writeBytes

public int writeBytes(byte[] b,
                      int off,
                      int len)
Description copied from interface: BT747OutputStream
Write bytes from byte buffer to file.

Specified by:
writeBytes in interface BT747OutputStream
Parameters:
b - Byte buffer.
off - Start offset in buffer to start writing to file.
len - Number of bytes to write to file.
Returns:
number of bytes written.

readBytes

public int readBytes(byte[] b,
                     int off,
                     int len)
Description copied from interface: BT747InputStream
Read bytes from file to buffer.

Specified by:
readBytes in interface BT747InputStream
Parameters:
b - Byte buffer.
off - Start offset in buffer to start reading from file.
len - Number of bytes to read from file.
Returns:
number of bytes read.

getCardVolumePath

public static java.lang.String getCardVolumePath()

getPath

public java.lang.String getPath()
Description copied from interface: BT747File
Get the file's path.

Specified by:
getPath in interface BT747File
Returns:
File path as a string.

getModificationTime

public int getModificationTime()
Description copied from interface: BT747File
Get modification time (UTC)

Specified by:
getModificationTime in interface BT747File