gr.bluevibe.fire.util
Class FireIO
java.lang.Object
gr.bluevibe.fire.util.FireIO
- public final class FireIO
- extends java.lang.Object
FireIO is a utility class containing a set of I/O supporting methods.
It also acts as a cache for loaded images. If an image is loaded once and is later requested again, the old instance will be returned.
This minimizes the memory requirements of an application GUI, without extra efford on the developer side.
- Author:
- padeler
Method Summary |
static void |
deleteAllFiles()
|
static boolean |
deleteFile(java.lang.String file)
|
static int |
free()
|
static javax.microedition.lcdui.Image |
getLocalImage(java.lang.String id)
|
static java.util.Vector |
list()
|
static byte[] |
makeRequest(java.lang.String url,
java.util.Hashtable headerFields,
byte[] data)
|
static byte[] |
read(java.lang.String f)
|
static void |
setup(java.util.Hashtable localFileMap,
int bufferSize,
java.lang.String downloadLocation)
Initializes the FireIO singleton. |
static int |
size(java.lang.String file)
|
static int |
total()
|
static void |
write(java.lang.String file,
byte[] buffer)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
setup
public static void setup(java.util.Hashtable localFileMap,
int bufferSize,
java.lang.String downloadLocation)
- Initializes the FireIO singleton. All the parameters are used by the image loading methods in this class.
- Parameters:
localFileMap
- A developer provided map, for image files in the jar (or on a remote location)bufferSize
- The number of image instances to be kept in the image cachedownloadLocation
- The location of the image repository.
If downloadLocation!=null and the image filename corresponding to the image key requested is not found,
the image is downloaded from the downloadLocation/filename.
list
public static java.util.Vector list()
deleteAllFiles
public static void deleteAllFiles()
deleteFile
public static boolean deleteFile(java.lang.String file)
total
public static int total()
size
public static int size(java.lang.String file)
free
public static int free()
write
public static void write(java.lang.String file,
byte[] buffer)
throws java.lang.Exception
- Throws:
java.lang.Exception
read
public static byte[] read(java.lang.String f)
throws java.lang.Exception
- Throws:
java.lang.Exception
getLocalImage
public static javax.microedition.lcdui.Image getLocalImage(java.lang.String id)
makeRequest
public static byte[] makeRequest(java.lang.String url,
java.util.Hashtable headerFields,
byte[] data)
throws java.io.IOException
- Throws:
java.io.IOException