com.legacyj.isam
Class ISAMFile

java.lang.Object
  |
  +--java.io.File
        |
        +--com.legacyj.isam.ISAMFile
All Implemented Interfaces:
java.lang.Comparable, ISAMConstants, java.io.Serializable

public class ISAMFile
extends java.io.File
implements java.io.Serializable, ISAMConstants

ISAMFile represents a complete ISAM file (data+keys+lock).

ISAMFile extends File and reimplements many of the File methods to be meaningful in an ISAM context. It also provides many of the ISAM functions in a form which do not require an explicit file descriptor, but rather are handled by the object itself.

ISAMJ Copyright 2000-2001 LegacyJ Corp. All Rights Reserved.

See Also:
Serialized Form

Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar

 

Fields inherited from interface com.legacyj.isam.ISAMConstants
AUDGETNAME, AUDHEADSIZE, AUDINFO, AUDSETNAME, AUDSTART, AUDSTOP, BYTEMASK, BYTESHFT, CHARSIZE, CHARTYPE, COLLATE1, COLLATE2, COLLATE3, COLLATE4, COLLATE5, COLLATE6, COLLATE7, COMPRESS, COMPRESS_O, DCOMPRESS, DECIMALTYPE, DOUBLESIZE, DOUBLETYPE, EARCHIVE, EAUDIT, EB_ARCH, EB_BUSY, EB_CHKNLOG, EB_DUPBS, EB_FULL, EB_IUBS, EB_NOBS, EB_NOCOL, EB_NOOPEN, EB_NOSUBSYS, EB_PAGE, EB_PSIZE, EB_SFULL, EB_STAMP, EBADARG, EBADCOLL, EBADFILE, EBADFORMAT, EBADKEY, EBADLOG, EBADMEM, EBADRMSG, EBADROWID, EBADSHMEM, EBADVCLEN, ECOL_SPEC, EDEADDEM, EDEADLOCK, EDEADTIME, EDEMO, EDISKMODE, EDUPL, EENDFILE, EEXPIRED, EFLOCKED, EFNAME, EGBLSECT, EINTERUPT, EKEXISTS, EKLOCKED, ELOCKED, ELOGOPEN, ELOGREAD, ELOGWRIT, ENEMPTY, ENLS_LANG, ENOBEGIN, ENOCLIENTS, ENOCONNECT, ENOCURR, ENODBS, ENOEXTN, ENOFREE, ENOLOCKS, ENOLOG, ENOLOK, ENOMANU, ENOMIRROR, ENONFS, ENOPARTN, ENOPRIM, ENOREC, ENOSHMEM, ENOSMI, ENOTEXCL, ENOTOPEN, ENOTRANS, EOYCHUNK, EOYDBS, EOYLOG, EOYPARTN, EOYPPAGE, EPMCHKBAD, EPRIMKEY, EROWSIZE, ES_ICONFIG, ES_IILLVAL, ES_ILLBUFF, ES_ILLFILE, ES_ILLLCKS, ES_ILLUSRS, ES_PROCDEFS, ES_SEMCTL, ES_SEMGET, ES_SHMCTL, ES_SHMGET, ETOOMANY, EUSER, FLOATSIZE, FLOATTYPE, IC_BADDATA, IC_BADMAGIC, IC_COUNT, IC_DATFREE, IC_DATREAD, IC_IDXREAD, IC_MATCH, IC_ORDER, ICLIENT, INTSIZE, INTTYPE, INVALID_ARGS, IO_AUD, IO_CREA, IO_DAT, IO_IDX, IO_IOCTL, IO_LCK, IO_LOCK, IO_LOG, IO_LOK, IO_OPEN, IO_READ, IO_SEEK, IO_SEM, IO_WRIT, IS_CREA, IS_IOCTL, IS_LOCK, IS_OPEN, IS_READ, IS_SEEK, IS_WRIT, ISADMIN, ISALL, ISAUDIT, ISAUTOLOCK, ISCISAM, ISCLOSED, ISCLUSTER, ISCURR, ISCUSTOM, ISDATAVOID, ISDECLARE, ISDESC, ISDUPLEN, ISDUPS, ISDYNAMIC, ISEQUAL, ISERRBASE, ISEXCLLOCK, ISEXCLLOCK_O, ISFIRST, ISFIXLEN, ISGREAT, ISGTEQ, ISHUGE, ISIDXBLK, ISINOUT, ISINPUT, ISIREADLOCK, ISISHARELOCK, ISIWRITELOCK, ISIZE, ISKEEPLOCK, ISKEEPLOCK_CISAM, ISLAST, ISLCKW, ISLKDEAD, ISLOCK, ISLOCKING, ISLOGGING, ISLONGID, ISLTYPMASK, ISMANULOCK, ISMASKED, ISMAXBUF, ISMAXIDX, ISMAXKEY, ISMAXOBJPC, ISMAXPARTS, ISMAXPARTS_O, ISNEXT, ISNOCARE, ISNOCASE, ISNOCHANGE, ISNODUPS, ISNOLOG, ISNONSPANNING, ISNORECOVER, ISNOWAIT, ISNOWAIT_O, ISOUTPUT, ISPREV, ISRDONLY, ISREADLOCK, ISRISHARE, ISRIWRITE, ISSHARELOCK, ISSIWRITE, ISSKIPLOCK, ISSKIPLOCK_C, ISSKIPLOCK_CISAM, ISSPANNING, ISSWRITE, ISSYNCWR, ISTRANS, ISUSERTYPESTART, ISVARCMP, ISVARIABLE, ISVARLEN, ISVARLEN_X, ISWAIT, ISWAIT_O, LCOMPRESS, LONGSIZE, LONGTYPE, MAXKEYSIZE, MAXKEYSIZE_O, MAXTYPE, MAXTYPE_X, MINTSIZE, MINTTYPE, MLONGSIZE, MLONGTYPE, NO_SUCH_FUNCTION, NPARTS, NULLKEY, STRINGSIZE, STRINGTYPE, SUCCESS, TCOMPRESS, TCOMPRESS_C, TCOMPRESS_O, TNULL, TYPEMASK, USERINFOSIZE, VARCHARSIZE, VARCHARTYPE, VAUDHEADSIZE

 

Constructor Summary
ISAMFile(java.io.File dir, java.lang.String name)
          Constructor
ISAMFile(java.io.File dir, java.lang.String name, int recordLength)
          Constructor
ISAMFile(java.lang.String path)
          Constructor
ISAMFile(java.lang.String path, int recordLength)
          Constructor
ISAMFile(java.lang.String path, java.lang.String name)
          Constructor
ISAMFile(java.lang.String path, java.lang.String name, int recordLength)
          Constructor

 

Method Summary
 void addIndex(ISAMKey key)
          Add a key to the index structure (isaddindex).
 void build(int recordLength, ISAMKey key, int mode)
          Build the ISAM file.
 void build(ISAMKey key, int mode)
          Build the ISAM file.
 void close()
          Close the ISAM file.
 boolean createNewFile()
          NOT IMPLEMENTED
 void delcurr()
          Delete current.
 boolean delete()
          Deletes the file specified by this object.
 void delete(ISAMRecord record)
          Delete given record.
 void delindex(ISAMKey key)
          Delete the index associated with key.
 void delrec(long recnum)
          Delete the record recnum
 boolean equals(java.lang.Object obj)
          Does this fully equal obj?
 boolean exists()
          Does any of this ISAMFile's parts exist?
 java.io.File getDataFile()
           
 int getErrorNumber()
           
 java.io.File getKeyFile()
           
 java.io.File getLockFile()
           
static int getMajorVersion()
          Major version number
static int getMinorVersion()
          Minor version number
 void indexinfo(ISAMDictInfo dest, int idx)
          Get index info into dest.
 void lock()
          Lock ISAM file.
 void open(int mode)
          Open ISAM file using mode.
 void read(ISAMRecord record, int mode)
          Read ISAM file into record using mode.
 void release()
          Release
 boolean renameTo(java.io.File dest)
          Rename this ISAM file to another File; File must be an instance of ISAMFile.
 boolean renameTo(ISAMFile dest)
          Rename this ISAM file to another ISAMFile
 void rewriteCurrent(ISAMRecord record)
          Rewrite Current
 void start(ISAMKey key, int len, ISAMRecord record, int mode)
          Start at given key set.
 void unlock()
          Unlock ISAM file.
 void write(ISAMRecord record)
          Write record.
 void writeCurrent(ISAMRecord record)
          Write record using current.

 

Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createTempFile, createTempFile, deleteOnExit, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, setLastModified, setReadOnly, toString, toURL

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Constructor Detail

ISAMFile

public ISAMFile(java.io.File dir,
                java.lang.String name)
Constructor
Parameters:
dir - directory
name - filename within directory (aside from extension)

ISAMFile

public ISAMFile(java.lang.String path)
Constructor
Parameters:
path - String representing complete ISAM filename (aside from extension)

ISAMFile

public ISAMFile(java.lang.String path,
                java.lang.String name)
Constructor
Parameters:
path - directory
name - filename (aside from extension)

ISAMFile

public ISAMFile(java.io.File dir,
                java.lang.String name,
                int recordLength)
Constructor
Parameters:
dir - directory
name - filename (aside from extension)
recordLength - default record length for file

ISAMFile

public ISAMFile(java.lang.String path,
                int recordLength)
Constructor
Parameters:
path - String representing complete ISAM filename (aside from extension)
recordLength - default record length for file

ISAMFile

public ISAMFile(java.lang.String path,
                java.lang.String name,
                int recordLength)
Constructor
Parameters:
path - directory
name - filename (aside from extension)
recordLength - default record length for file
Method Detail

getMajorVersion

public static final int getMajorVersion()
Major version number
Returns:
major version of ISAMJ

getMinorVersion

public static final int getMinorVersion()
Minor version number
Returns:
minor version of ISAMJ

exists

public boolean exists()
Does any of this ISAMFile's parts exist?
Overrides:
exists in class java.io.File
Returns:
boolean true if any part does exist

renameTo

public boolean renameTo(java.io.File dest)
Rename this ISAM file to another File; File must be an instance of ISAMFile.
Overrides:
renameTo in class java.io.File
Parameters:
dest - file designation to rename file to
Returns:
boolean true if successful
Throws:
java.lang.SecurityException - if cannot write to both old and new path

renameTo

public boolean renameTo(ISAMFile dest)
Rename this ISAM file to another ISAMFile
Parameters:
dest - file designation to rename file to
Returns:
boolean true if successful
Throws:
java.lang.SecurityException - if cannot write to both old and new path

delete

public boolean delete()
Deletes the file specified by this object. If the target file to be deleted is a directory, it must be empty for deletion to succeed.
Overrides:
delete in class java.io.File
Returns:
boolean true if the file is successfully deleted; false otherwise.
Throws:
java.lang.SecurityException - if a security manager exists, its checkDelete method is called with the pathname of this File to see if the application is allowed to delete the file.

equals

public boolean equals(java.lang.Object obj)
Does this fully equal obj?
Overrides:
equals in class java.io.File
Parameters:
obj - The object to compare against.

createNewFile

public boolean createNewFile()
                      throws java.io.IOException
NOT IMPLEMENTED
Overrides:
createNewFile in class java.io.File
Returns:
true if file does not exist and was successfully created.
Throws:
java.io.IOException -  

getKeyFile

public java.io.File getKeyFile()
Returns:
a File instance accociated with this ISAMFile's key file (.idx)

getLockFile

public java.io.File getLockFile()
Returns:
a File instance accociated with this ISAMFile's key file (.lck)

getDataFile

public java.io.File getDataFile()
Returns:
a File instance accociated with this ISAMFile's data file; this is the same File instance as ISAMFile itself.

getErrorNumber

public int getErrorNumber()
Returns:
ISAM error number.

addIndex

public void addIndex(ISAMKey key)
              throws java.io.IOException
Add a key to the index structure (isaddindex).
Parameters:
key - ISAM Key
Throws:
java.io.IOException - if file not open

build

public void build(ISAMKey key,
                  int mode)
           throws java.io.IOException
Build the ISAM file.
Parameters:
key - ISAM Key
mode - Mode to build.
Throws:
java.io.IOException - if file not closed

build

public void build(int recordLength,
                  ISAMKey key,
                  int mode)
           throws java.io.IOException
Build the ISAM file.
Parameters:
recordLength - of ISAM file.
key - The ISAMKey.
mode -  
Throws:
java.io.IOException - if file not closed

close

public void close()
           throws java.io.IOException
Close the ISAM file.
Throws:
java.io.IOException - if file not open

delcurr

public void delcurr()
             throws java.io.IOException
Delete current.
Throws:
java.io.IOException - if file not open

delete

public void delete(ISAMRecord record)
            throws java.io.IOException
Delete given record.
Parameters:
record - ISAMRecord.
Throws:
java.io.IOException - if file not open

delindex

public void delindex(ISAMKey key)
              throws java.io.IOException
Delete the index associated with key.
Parameters:
key - ISAMKey.
Throws:
java.io.IOException - if file not open

delrec

public void delrec(long recnum)
            throws java.io.IOException
Delete the record recnum
Parameters:
recnum - Record number.
Throws:
java.io.IOException - if file not open

indexinfo

public void indexinfo(ISAMDictInfo dest,
                      int idx)
               throws java.io.IOException
Get index info into dest.
Parameters:
dest - ISAMDictInfo
idx - Index number.
Throws:
java.io.IOException - if file not open

lock

public void lock()
          throws java.io.IOException
Lock ISAM file.
Throws:
java.io.IOException - if file not open

open

public void open(int mode)
          throws java.io.IOException
Open ISAM file using mode.
Parameters:
mode -  
Throws:
java.io.IOException - if file not closed

read

public void read(ISAMRecord record,
                 int mode)
          throws java.io.IOException
Read ISAM file into record using mode.
Parameters:
record - ISAMRecord
mode -  
Throws:
java.io.IOException - if file not open

release

public void release()
             throws java.io.IOException
Release
Throws:
java.io.IOException - if file not open

rewriteCurrent

public void rewriteCurrent(ISAMRecord record)
                    throws java.io.IOException
Rewrite Current
Parameters:
record - Record to rewrite.
Throws:
java.io.IOException - if file not open

start

public void start(ISAMKey key,
                  int len,
                  ISAMRecord record,
                  int mode)
           throws java.io.IOException
Start at given key set.
Parameters:
key - ISAMKey
len - Length
record - ISAMRecord
mode -  
Throws:
java.io.IOException - if file not open

unlock

public void unlock()
            throws java.io.IOException
Unlock ISAM file.
Throws:
java.io.IOException - if file not open

writeCurrent

public void writeCurrent(ISAMRecord record)
                  throws java.io.IOException
Write record using current.
Parameters:
record - ISAMRecord
Throws:
java.io.IOException - if file not open

write

public void write(ISAMRecord record)
           throws java.io.IOException
Write record.
Parameters:
record - ISAMRecord
Throws:
java.io.IOException - if file not open


©Copyright LegacyJ Corporation 2001