FileDocCategorySizeDatePackage
PKCS15File.javaAPI DocphoneME MR2 API (J2ME)5570Wed May 02 18:00:38 BST 2007com.sun.satsa.util.pkcs15

PKCS15File

public class PKCS15File extends Object
This class represents PKCS15 file abstraction

Fields Summary
protected static final short
ODFPath
ODF path.
protected static final short
TokenInfoPath
EF(TokenInfo) path.
protected static final short
UnusedSpace
EF(UnusedSpace) path.
protected Vector
loaderObjects
This vector contains objects loaded from directory file.
protected Vector
loaderLocations
This vector contains locations of loaded objects.
protected Vector
loaderFreeBlocks
This vector contains locations of free space in directory files.
protected Location
location
Location
protected FileSystemAbstract
files
File system object.
Constructors Summary
protected PKCS15File(Location location, FileSystemAbstract files)
Create the object for the pointed file system and location

param
location Location required location
param
files FileSystemAbstract required file system


                              
         
        this.location = location;
        this.files = files;
    
protected PKCS15File(FileSystemAbstract files)
Create the object for the pointed file system

param
files FileSystemAbstract required file system

        this.files = files;
    
Methods Summary
protected static voiddoParseDF(byte[] data, short[] path, java.util.Vector objects, java.util.Vector locations, java.util.Vector freeBlocks)
Parses EF(DF).

param
data data to be parsed
param
path file path
param
objects method places objects from file into this vector. Can be null. Contains values of TLV type
param
locations method places location of objects into this vector. Can be null. Contains values of type Location.
param
freeBlocks method places locations of free memory in EF(DF) into this vector. Can be null. Contains values of type Location.
throws
TLVException if parsing error occurs

        int start = 0;
        int current = 0;
        while (current < data.length) {
                // free space - skip
            if (data[current] == (byte) 0xff) {
                current++;
                continue;
            }
            // TLV object
            TLV t = new TLV(data, current);
            // empty one - skip
            if (t.type == 0) {
                current = t.valueOffset + t.length;
                continue;
            }
            // real object
            if (objects != null) {
                objects.addElement(t);
            }
            if (locations != null) {
                locations.addElement(new Location(path, current,
                               t.valueOffset + t.length - current));
            }
            if (freeBlocks != null && start < current) {
                freeBlocks.addElement(
                    new Location(path, start, current - start));
            }
            current = t.valueOffset + t.length;
            start = current;
        }
        if (start < current && freeBlocks != null) {
            freeBlocks.addElement(
                        new Location(path, start, current - start));
        }
    
protected voidparseDF(short[] path)
Parses directory file. Places results into vectors specified resetLoader method.

param
path path to directory file
throws
TLVException if parsing error occurs
throws
IOException if I/O error occurs

        if (path.length > 1) {
            files.select(path);
        } else {
            files.select(path[0]);
        }
        doParseDF(files.readFile(), path,
                      loaderObjects, loaderLocations, loaderFreeBlocks);
    
protected voidresetLoader(java.util.Vector objects, java.util.Vector locations, java.util.Vector freeBlocks)
Initialises object loader.

param
objects vector for loaded objects or null
param
locations vector for object locations or null
param
freeBlocks vector for unused block locations or null

        loaderObjects = objects;
        loaderLocations = locations;
        loaderFreeBlocks = freeBlocks;