Open SiteSearch 4.1.1
Final

ORG.oclc.ber
Class DataDir

java.lang.Object
  |
  +--ORG.oclc.ber.ASN1
        |
        +--ORG.oclc.ber.DataDir
Direct Known Subclasses:
DataDirTree

public class DataDir
extends ASN1

DataDir is a class for manipulating tree structures and for putting data into and getting data out of tree structures.

Example: Create a DBI Begin Session request and get the session id from the response. This example assumes methods to send requests and get responses from a DBI Server.

BerString ber_record;
DataDir dir, subdir;
int sessid;
//
dir = new DataDir(DBI.DBI_IN, ASN1.APPLICATION);  // create DataDir
subdir = dir.add(DBI.BEGINS, ASN1.CONTEXT);       // make it a Begin Session
subdir.add(DBI.BS_USERID, ASN1.CONTEXT, "ralph"); // add userid
ber_record = new BerString(dir);                  // make BER record
//
send_request(ber_record);
ber_record = get_response();
//
dir = new DataDir(ber_record);
subdir = dir.child();       // skip over DBI_OUT node
subdir = subdir.child();    // skip over BEGINS node
while (subdir != null)      // find node with tag==SESSID
{
if (subdir.fldid() == DBI.SESSID)
{
sessid = subdir.getInt();
break;
}
subdir = subdir.next();    // point to sibling of this node
}

See Also:
ASN1

Field Summary
 int asn1class
           
 int fldid
           
 Object obj
           
 
Fields inherited from class ORG.oclc.ber.ASN1
APPLICATION, arbitrary, BITSTRING, BOOLEAN, CONSTRUCTED, CONTEXT, ENUMERATED, EXTERNAL, GENERALSTRING, INTEGER, NULL, OBJECTDESCRIPTOR, OBJECTIDENTIFIER, octet_aligned, OCTETSTRING, PRIMITIVE, PRIVATE, SEQUENCE, SET, single_ASN1_type, UNIVERSAL, VISIBLESTRING
 
Constructor Summary
protected DataDir()
           
  DataDir(BerString record)
          Create a DataDir tree from a BER record.
  DataDir(DataDir parent_dir, int fldid, byte asn1class)
          Deprecated. see see DataDir(DataDir, int, int)
  DataDir(DataDir parent_dir, int fldid, int asn1class)
          Create a non-leaf node that will be a child of the specified parent.
  DataDir(int fldid, byte asn1class)
          Deprecated. see see DataDir(int, int)
  DataDir(int fldid, int asn1class)
          Create a root (non-leaf and no parent) DataDir with the specified fldid and asn1class.
  DataDir(int fldid, int asn1class, long num)
          Create a leaf (with no parent) DataDir with the specified fldid, asn1class, and data.
  DataDir(int fldid, int asn1class, Object obj)
          Create a leaf (with no parent) DataDir with the specified fldid, asn1class, and data.
 
Method Summary
 DataDir add(DataDir newdir)
          Add a DataDir as the last child of this one.
 DataDir add(DataDir newdir, int offset)
          Add a DataDir as a child of this one at a specified offset.
 DataDir add(int fldid, int asn1class)
          Add a non-leaf child of this DataDir.
 DataDir add(int fldid, int asn1class, byte[] data)
          Add a leaf DataDir to the directory with an array of 8-bit byte data.
 DataDir add(int fldid, int asn1class, byte[] data, int offset, int len)
          Add a leaf DataDir to the directory with data contained in a byte array.
 DataDir add(int fldid, int asn1class, DataDirObject obj)
          Add a leaf DataDir to the directory with DataDirObject data.
 DataDir add(int fldid, int asn1class, int num)
          Add a leaf DataDir to the directory with INTEGER data.
 DataDir add(int fldid, int asn1class, long num)
          Add a leaf DataDir to the directory with LONG data.
 DataDir add(int fldid, int asn1class, String data)
          Add a leaf DataDir to the directory with String data.
 DataDir add(int fldid, int asn1class, String data, String enc)
          Add a leaf DataDir to the directory with String data.
 DataDir addBits(int fldid, int asn1class, String bits)
          Add a leaf DataDir which contains a BITSTRING to a directory.
 DataDir addOID(int fldid, int asn1class, String OID)
          Add a leaf DataDir to a directory which contains an OID.
 DataDir addUTF(int fldid, int asn1class, String data)
          Add a leaf DataDir to the directory with String data.
 void asmRec(BerString record)
          Assembles a BER record from a DataDir into a BerString object.
 byte asn1class()
          Accessor method for asn1class for this DataDir.
 DataDir child()
          Accessor method for child of this DataDir.
 Object clone()
          Clone the DataDir and all it's children and siblings.
 Object clone(boolean doSibs)
          Clone the DataDir and all it's children.
 int count()
          Accessor method for count for this DataDir.
 DataDir daddBits(int fldid, byte asn1class, String bits)
          Deprecated. Use addBits method instead.
 DataDir daddBytes(int fldid, byte asn1class, byte[] data)
          Deprecated. Use add method instead.
 DataDir daddBytes(int fldid, byte asn1class, byte[] data, int offset, int len)
          Deprecated. Use add method instead.
 DataDir daddChar(int fldid, byte asn1class, byte[] data)
          Deprecated. Use the add method instead
 DataDir daddChar(int fldid, byte asn1class, byte[] data, int offset, int len)
          Deprecated. Use the add method instead
 DataDir daddChar(int fldid, byte asn1class, String data)
          Deprecated. Use the add method instead.
 DataDir daddDir(DataDir newdir)
          Deprecated. Use the add method instead.
 DataDir daddDir(DataDir newdir, int offset)
          Deprecated. Use the add method instead.
 DataDir daddNum(int fldid, byte asn1class, int num)
          Deprecated. Use the add method instead.
 DataDir daddNum(int fldid, byte asn1class, long num)
          Deprecated. Use the add method instead.
 void daddObj(DataDirObject obj)
          Deprecated. Use replace method instead
 DataDir daddObj(int fldid, byte asn1class, DataDirObject obj)
          Deprecated. Use the add method instead.
 DataDir daddoid(int fldid, byte asn1class, String OID)
          Deprecated. Use addOID method instead.
 DataDir daddString(int fldid, byte asn1class, String data)
          Deprecated. Use add method instead
 DataDir daddTag(int fldid, byte asn1class)
          Deprecated. Use add method instead.
 byte[] data()
          Accessor method for data for this DataDir.
 void data(byte[] dest, int offset, int length)
          Accessor method for data for this DataDir.
 boolean dataEquals(DataDir that)
          Compares this DataDir's data array to the specified DataDir's data array.
 boolean ddelDir()
          Deprecated. Use the delete method instead.
 void delete()
          Delete this DataDir and its children from a DataDir tree.
 String dgetBits()
          Deprecated. Use the getBits method instead
 String dgetChar()
          Deprecated. Use getString method instead.
 long dgetLong()
          Deprecated. Use the getLong method instead.
 int dgetNum()
          Deprecated. Use the getLong method instead.
 String dgetoid()
          Deprecated. Use the getOID method instead.
 DataDir diff(DataDir that)
          Returns a new DataDir that contains the difference betweeen the current DataDir and the input DataDir.
 DataDir dinsTag(int fldid, byte asn1class)
          Deprecated. Use insertParent instead
 void drepChar(String data)
          Deprecated. Use replace method instead.
 DataDir dreplaceDir(DataDir newdir)
          Deprecated. Use the replace method instead.
 DataDir dreplaceNum(int num)
          Deprecated. Use the replace method instead.
 boolean dtagFound(int fldid, byte asn1class)
          Deprecated. Use the find and findNext methods instead.
 DataDir dtagLocate(int fldid, byte asn1class)
          Deprecated. Use the find and findNext methods instead.
 DataDir dtagLocate(int fldid, byte asn1class, int occurrence)
          Deprecated. Use the find and findNext methods instead.
 boolean equals(DataDir that)
          Compares this DataDir to the specified DataDir.
 DataDir find(int fldid)
          Finds a child DataDir of this DataDir.
 DataDir find(int fldid, int asn1class)
          Finds a child DataDir of this DataDir.
 DataDir find(int fldid, int asn1class, int occurrence)
          Finds a child DataDir of this DataDir.
 DataDir findDataNode()
          Locates the first DataDir object for the first occurrence of a primitive data node where data is located.
 DataDir findDataNode(int f)
          Locates the DataDir object for the primitive node matching the input fieldid.
 DataDir findNext(int fldid, int asn1class)
          Finds a child DataDir of this DataDir, continuing from where the last find or findNext method left off it's search.
 DataDir findNode()
           
 DataDir findNode(int f)
           
 int fldid()
          Accessor method for fldid for this DataDir.
 byte form()
          Accessor method for form for this DataDir.
 String getBits()
          Get a BITSTRING from a leaf DataDir.
 byte[] getBytes()
          Get an array of bytes from a leaf DataDir.
 String getData()
          Locates the first primitive data node and returns the String data held at that location.
 String getData(int f)
          Locates the primitive data node for the input fieldid and returns the String data held at that location.
 int getInt()
          Get an int from a leaf DataDir.
 long getLong()
          Get a long from a leaf DataDir.
 String getOID()
          Get a human readable OID from a leaf DataDir.
 String getString()
          Get a String from a leaf DataDir.
 String getString(String enc)
          Get a String from a leaf DataDir whose bytes are in a specific encoding.
 String getUTFString()
          Get a String from a leaf DataDir whose bytes are encoded as UTF8.
 boolean hasSameDataAs(DataDir that)
          Deprecated. Use dataEquals method instead.
 DataDir insertAfter(DataDir newDir)
          Insert a new DataDir tree after this DataDir node.
 DataDir insertBefore(DataDir newDir)
          Insert a new DataDir tree before this DataDir node.
 DataDir insertParent(int fldid, int asn1class)
          Insert a new parent DataDir above this DataDir and all its siblings.
 int integerData()
          Deprecated. Use getInt or getLong instead.
 boolean isSameAs(DataDir that)
          Deprecated. Use equals method instead.
 DataDir next()
          Accessor method for next sibling of this DataDir.
 DataDir nextElement()
          Accessor method for next sibling of this DataDir.
 DataDirObject object()
          Accessor method for DataDirObject for this DataDir.
 DataDir parent()
          Accessor method for parent of this DataDir.
 DataDir prev()
          Accessor method for previous sibling of this DataDir.
 DataDir prevElement()
          Accessor method for previous sibling of this DataDir.
 void print()
          Prints a formatted hex dump of the directory to stdout.
 int recLen()
          Returns the length of the BER record that would be created from the branch of the DataDir tree started at this DataDir.
 void replace(byte[] data)
          Replace the data contents with a new byte array
 void replace(DataDir newdir)
          Replace this dir with another
 void replace(DataDirObject obj)
          Remove the reference to any data and create a reference to the specified DataDirObject.
 void replace(int num)
          Replace the data contents with an INTEGER value.
 void replace(long num)
          Replace the data contents with a LONG value.
 void replace(String data)
          Replace the data contents with a new String
 void replaceData(String subdata)
          Locates the first primitive data node and replaces the data held at that location with the input data.
 DataDir replaceDir(DataDir newdir)
          Replace this dir with another and return the correct location.
 void replaceUTF(String data)
          Replace the data contents with the UTF8 encoding of a new String
 void resetChild()
          Set the child to null.
 void resetNext()
          Set the next to null.
 void resetParent()
          Set the parent to null.
 void resetPrev()
          Set the prev to null.
 void setClass(byte val)
          Deprecated. see setClass(int)
 void setClass(int val)
          Replace the asn1class with a new value
 void setFldid(int fldid)
          Change the fldid setting.
 String stringData()
          Deprecated. Use the getString method instead.
 DataDir subElement()
          Accessor method for child of this DataDir.
 String toString()
          Produce a formatted hex dump of a directory.
 void writeToFile(String filename)
          Convenience method for writing DataDirs to files.
 void writeToFile(String filename, boolean append)
          Convenience method for writing DataDirs to files.
 
Methods inherited from class ORG.oclc.ber.ASN1
getLong, getNum, lenLen, numLen, putNum, tagLen
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fldid

public int fldid

asn1class

public int asn1class

obj

public Object obj
Constructor Detail

DataDir

protected DataDir()

DataDir

public DataDir(int fldid,
               byte asn1class)
Deprecated. see see DataDir(int, int)
Create a root (non-leaf and no parent) DataDir with the specified fldid and asn1class.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir

DataDir

public DataDir(int fldid,
               int asn1class)
Create a root (non-leaf and no parent) DataDir with the specified fldid and asn1class.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir

DataDir

public DataDir(int fldid,
               int asn1class,
               long num)
Create a leaf (with no parent) DataDir with the specified fldid, asn1class, and data. This node can be added to a tree with the add method from a node already on the tree.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
obj - data to be put into the new DataDir

DataDir

public DataDir(int fldid,
               int asn1class,
               Object obj)
Create a leaf (with no parent) DataDir with the specified fldid, asn1class, and data. Only String, and byte[] are supported. All other data will be ignored and can be put into the DataDir with a replace method. This node can be added to a tree with the add method from a node already on the tree.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
obj - data to be put into the new DataDir

DataDir

public DataDir(DataDir parent_dir,
               int fldid,
               byte asn1class)
Deprecated. see see DataDir(DataDir, int, int)
Create a non-leaf node that will be a child of the specified parent.
Parameters:
fldid - tag to be assigned to new node
asn1class - class to be assigned to new node

DataDir

public DataDir(DataDir parent_dir,
               int fldid,
               int asn1class)
Create a non-leaf node that will be a child of the specified parent.
Parameters:
fldid - tag to be assigned to new node
asn1class - class to be assigned to new node

DataDir

public DataDir(BerString record)
Create a DataDir tree from a BER record.
Parameters:
record - BER record
Method Detail

add

public final DataDir add(DataDir newdir)
Add a DataDir as the last child of this one.
Parameters:
newdir - DataDir to be added

add

public final DataDir add(DataDir newdir,
                         int offset)
Add a DataDir as a child of this one at a specified offset.
Parameters:
newdir - DataDir to be added
offset - 0=first child; >0 = position; >number of children = last

add

public DataDir add(int fldid,
                   int asn1class)
Add a non-leaf child of this DataDir.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir

add

public final DataDir add(int fldid,
                         int asn1class,
                         byte[] data)
Add a leaf DataDir to the directory with an array of 8-bit byte data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
data - String reference

add

public final DataDir add(int fldid,
                         int asn1class,
                         byte[] data,
                         int offset,
                         int len)
Add a leaf DataDir to the directory with data contained in a byte array.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
byte[] - data array containing bytes to be added
int - offset into array
int - len of data to be added

add

public final DataDir add(int fldid,
                         int asn1class,
                         int num)
Add a leaf DataDir to the directory with INTEGER data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
num - int to be added

add

public final DataDir add(int fldid,
                         int asn1class,
                         long num)
Add a leaf DataDir to the directory with LONG data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
num - long to be added

add

public DataDir add(int fldid,
                   int asn1class,
                   DataDirObject obj)
Add a leaf DataDir to the directory with DataDirObject data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
obj - DataDirObject to be added

add

public final DataDir add(int fldid,
                         int asn1class,
                         String data)
Add a leaf DataDir to the directory with String data. Render the String to bytes using the system default encoding.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
data - String to be added

add

public final DataDir add(int fldid,
                         int asn1class,
                         String data,
                         String enc)
                  throws UnsupportedEncodingException
Add a leaf DataDir to the directory with String data. Render the String to bytes using the system default encoding.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
data - String to be added
enc - byte encoding to use
Throws:
UnsupportedEncodingException - thrown by the String.getBytes() method
See Also:
String.getBytes()

addBits

public final DataDir addBits(int fldid,
                             int asn1class,
                             String bits)
Add a leaf DataDir which contains a BITSTRING to a directory. NOTE: Any of the characters '1', 'y', 'Y', 't' or 'T' get a 1 in the encoded bitstring. Any other characters get a 0.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
bits - String containing array of bits.

addOID

public final DataDir addOID(int fldid,
                            int asn1class,
                            String OID)
Add a leaf DataDir to a directory which contains an OID.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
cstring - String containing human readable OID

addUTF

public final DataDir addUTF(int fldid,
                            int asn1class,
                            String data)
Add a leaf DataDir to the directory with String data. Render the String to bytes using the UTF-8 encoding. The advantage of using this over the simple add method for strings is that this method does not throw the UnsupportedEncodingException.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
data - String to be added

asmRec

public final void asmRec(BerString record)
Assembles a BER record from a DataDir into a BerString object. NOTE: recLen() must be called immediately before calling asmRec(). recLen() sets information in the DataDir that is critical for the function of asmRec(). recLen() also returns the length needed to construct the BerString object.
Parameters:
record - object to hold BER record

clone

public final Object clone()
Clone the DataDir and all it's children and siblings. It will clone all data referenced by the DataDirs.
Returns:
cloned DataDir
Overrides:
clone in class Object

clone

public final Object clone(boolean doSibs)
Clone the DataDir and all it's children. doSibs indicates whether to do the siblings of the DataDir.
Parameters:
doSibs - true = clone siblings; false = do not clone siblings
Returns:
cloned DataDir

dataEquals

public boolean dataEquals(DataDir that)
Compares this DataDir's data array to the specified DataDir's data array. The result is true if and only if the argument is not null and is a DataDir that contains the same data array as this DataDir object.
Parameters:
that - - the DataDir to compare with.
Returns:
true if the object's data are the same; false otherwise.

delete

public final void delete()
Delete this DataDir and its children from a DataDir tree. This method does nothing if this DataDir is the root of the DataDir tree.

diff

public DataDir diff(DataDir that)
Returns a new DataDir that contains the difference betweeen the current DataDir and the input DataDir.
Parameters:
that -  
Returns:
DataDir

equals

public boolean equals(DataDir that)
Compares this DataDir to the specified DataDir. The result is true if and only if the argument is not null and is a DataDir object that contains the same nodes and data values as this DataDir object.
Parameters:
that - - the DataDir to compare with.
Returns:
true if the objects are the same; false otherwise.

find

public final DataDir find(int fldid)
Finds a child DataDir of this DataDir.
Parameters:
fldid - tag of DataDir to be found
Returns:
DataDir if found, null if not found

find

public final DataDir find(int fldid,
                          int asn1class)
Finds a child DataDir of this DataDir.
Parameters:
fldid - tag of DataDir to be found
asn1class - class of DataDir to be found
Returns:
DataDir if found, null if not found

find

public final DataDir find(int fldid,
                          int asn1class,
                          int occurrence)
Finds a child DataDir of this DataDir.
Parameters:
fldid - tag of DataDir to be found
asn1class - class of DataDir to be found
occurrence - number of occrrences of the DataDir to be found
Returns:
DataDir if found, null if not found

findNext

public final DataDir findNext(int fldid,
                              int asn1class)
Finds a child DataDir of this DataDir, continuing from where the last find or findNext method left off it's search.
Parameters:
fldid - tag of DataDir to be found
asn1class - class of DataDir to be found
Returns:
DataDir if found, null if not found

getBits

public final String getBits()
Get a BITSTRING from a leaf DataDir.
Returns:
A String with 'y' for 1 bits and 'n' for 0 bits.

getBytes

public final byte[] getBytes()
Get an array of bytes from a leaf DataDir.
Returns:
byte[]

getInt

public final int getInt()
Get an int from a leaf DataDir.
Returns:
value of int data. Undefined if not a leaf DataDir or if leaf DataDir doesn't contain int data.
Throws:
java.lang.ArithmeticException - thrown when number is too large to fit into an int.

getLong

public final long getLong()
Get a long from a leaf DataDir.
Returns:
value of long data. Undefined if not a leaf DataDir or if leaf DataDir doesn't contain long data.

getOID

public final String getOID()
Get a human readable OID from a leaf DataDir.
Returns:
A String with human readable OID

getString

public final String getString()
Get a String from a leaf DataDir.
Returns:
String

getString

public final String getString(String enc)
                       throws UnsupportedEncodingException
Get a String from a leaf DataDir whose bytes are in a specific encoding.
Parameters:
enc - String containing byte encoding.
Returns:
String
Throws:
UnsupportedEncodingException - thrown by String constructor.
See Also:
String

getUTFString

public final String getUTFString()
Get a String from a leaf DataDir whose bytes are encoded as UTF8.
Returns:
String

insertAfter

public DataDir insertAfter(DataDir newDir)
Insert a new DataDir tree after this DataDir node.
Parameters:
newDir - new tree to be inserted after this node.

insertBefore

public DataDir insertBefore(DataDir newDir)
Insert a new DataDir tree before this DataDir node.
Parameters:
newDir - new tree to be inserted before this node.

insertParent

public DataDir insertParent(int fldid,
                            int asn1class)
Insert a new parent DataDir above this DataDir and all its siblings.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir

recLen

public final int recLen()
Returns the length of the BER record that would be created from the branch of the DataDir tree started at this DataDir.
Returns:
length of record that would be created by asmRec().

replace

public final void replace(DataDir newdir)
Replace this dir with another
Parameters:
newdir - directory to replace this one with

replace

public final void replace(DataDirObject obj)
Remove the reference to any data and create a reference to the specified DataDirObject.

This is useful when the DataDir was constructed from a BerString. The caller can create an object from the byte array in the original DataDir and then replace the byte array with a reference to the desired object.

Parameters:
obj - object reference to added to DataDir

replace

public final void replace(int num)
Replace the data contents with an INTEGER value.
Parameters:
num - INTEGER

replace

public final void replace(long num)
Replace the data contents with a LONG value.
Parameters:
num - LONG

replace

public final void replace(String data)
Replace the data contents with a new String
Parameters:
data - String reference

replace

public final void replace(byte[] data)
Replace the data contents with a new byte array
Parameters:
data - byte[]

replaceDir

public final DataDir replaceDir(DataDir newdir)
Replace this dir with another and return the correct location.
Parameters:
newdir - directory to replace this one with
Returns:
the new dir

replaceUTF

public final void replaceUTF(String data)
Replace the data contents with the UTF8 encoding of a new String
Parameters:
data - String reference

setClass

public final void setClass(int val)
Replace the asn1class with a new value
Parameters:
value -  

setFldid

public final void setFldid(int fldid)
Change the fldid setting.
Parameters:
fldid - to change the node to.

print

public final void print()
Prints a formatted hex dump of the directory to stdout.

toString

public final String toString()
Produce a formatted hex dump of a directory.
Returns:
String
Overrides:
toString in class Object

writeToFile

public void writeToFile(String filename)
Convenience method for writing DataDirs to files. Creates or appends a file depending on the specified value of the append parameter and creates BerString object from the DataDir. The method writes the BerString of the DataDir to the open file.
Parameters:
filename - - name of the file to write.

writeToFile

public void writeToFile(String filename,
                        boolean append)
Convenience method for writing DataDirs to files. Creates or appends a file depending on the specified value of the append parameter and creates BerString object from the DataDir. The method writes the BerString of the DataDir to the open file.
Parameters:
filename - - name of the file to write.
append - - boolean indicating whether or not append the file.
See Also:
BerString, FileOutputStream, BufferOutputStream

child

public final DataDir child()
Accessor method for child of this DataDir.

subElement

public final DataDir subElement()
Accessor method for child of this DataDir. Does the same thing as child()

parent

public final DataDir parent()
Accessor method for parent of this DataDir.

next

public final DataDir next()
Accessor method for next sibling of this DataDir.

nextElement

public final DataDir nextElement()
Accessor method for next sibling of this DataDir. Does the same thing as next()

prev

public final DataDir prev()
Accessor method for previous sibling of this DataDir.

prevElement

public final DataDir prevElement()
Accessor method for previous sibling of this DataDir. Does the same thing as prev()

object

public final DataDirObject object()
Accessor method for DataDirObject for this DataDir.

data

public final void data(byte[] dest,
                       int offset,
                       int length)
Accessor method for data for this DataDir.

data

public final byte[] data()
Accessor method for data for this DataDir.

fldid

public final int fldid()
Accessor method for fldid for this DataDir.

asn1class

public final byte asn1class()
Accessor method for asn1class for this DataDir.

form

public final byte form()
Accessor method for form for this DataDir.

count

public final int count()
Accessor method for count for this DataDir.

If the DataDir is PRIMITIVE, then the count is the length of the data, object or number.

If the DataDir is CONSTRUCTED, then the count is the number of children belonging to this DataDir.


resetNext

public final void resetNext()
Set the next to null.

resetPrev

public final void resetPrev()
Set the prev to null.

resetChild

public final void resetChild()
Set the child to null.

resetParent

public final void resetParent()
Set the parent to null.

daddBits

public final DataDir daddBits(int fldid,
                              byte asn1class,
                              String bits)
Deprecated. Use addBits method instead.
Add a leaf DataDir which contains a BITSTRING to a directory. NOTE: Any of the characters '1', 'y', 'Y', 't' or 'T' get a 1 in the encoded bitstring. Any other characters get a 0.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
bits - String containing array of bits.

daddBytes

public final DataDir daddBytes(int fldid,
                               byte asn1class,
                               byte[] data)
Deprecated. Use add method instead.
Add a leaf DataDir to the directory with an array of 8-bit byte data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
byte[] - data

daddBytes

public final DataDir daddBytes(int fldid,
                               byte asn1class,
                               byte[] data,
                               int offset,
                               int len)
Deprecated. Use add method instead.
Add a leaf DataDir to the directory with byte[] data. I hope to deprecate the old daddChar method.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
byte[] - data
int - offset
int - len

daddChar

public final DataDir daddChar(int fldid,
                              byte asn1class,
                              byte[] data,
                              int offset,
                              int len)
Deprecated. Use the add method instead
Add a leaf DataDir to the directory with byte[] data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
byte[] - data
int - offset
int - len

daddChar

public final DataDir daddChar(int fldid,
                              byte asn1class,
                              byte[] data)
Deprecated. Use the add method instead
Add a leaf DataDir to the directory with byte[] data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
byte[] - data

daddChar

public final DataDir daddChar(int fldid,
                              byte asn1class,
                              String data)
Deprecated. Use the add method instead.
Add a leaf DataDir to the directory with a string of 7-bit byte data. The data will be converted to a byte array.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
data - String reference

daddDir

public final DataDir daddDir(DataDir newdir)
Deprecated. Use the add method instead.
Attach one directory to another.
Parameters:
newdir - directory to be added

daddDir

public final DataDir daddDir(DataDir newdir,
                             int offset)
Deprecated. Use the add method instead.
Attach one directory to another at a specified offset.
Parameters:
newdir - directory to be added
offset - 0=first child; >0 = position; >number of children = last

daddNum

public final DataDir daddNum(int fldid,
                             byte asn1class,
                             int num)
Deprecated. Use the add method instead.
Add a leaf DataDir to the directory with INTEGER data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
num - INTEGER

daddNum

public final DataDir daddNum(int fldid,
                             byte asn1class,
                             long num)
Deprecated. Use the add method instead.
Add a leaf DataDir to the directory with LONG data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
num - LONG

daddObj

public void daddObj(DataDirObject obj)
Deprecated. Use replace method instead
Remove the reference to any data and create a reference to the specified DataDirObject. This is useful when the DataDir was constructed from a BerString. The caller can create an object from the byte array in the original DataDir and then replace the byte array with a reference to the desired object.
Parameters:
obj - object reference to added to DataDir

daddObj

public DataDir daddObj(int fldid,
                       byte asn1class,
                       DataDirObject obj)
Deprecated. Use the add method instead.
Add a leaf DataDir to the directory with DataDirObject data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
obj - object reference

daddoid

public final DataDir daddoid(int fldid,
                             byte asn1class,
                             String OID)
Deprecated. Use addOID method instead.
Add a leaf DataDir to a directory which contains an OID.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
OID - String containing human readable OID

daddString

public final DataDir daddString(int fldid,
                                byte asn1class,
                                String data)
Deprecated. Use add method instead
Add a leaf DataDir to the directory with String data.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir
data - String reference

daddTag

public DataDir daddTag(int fldid,
                       byte asn1class)
Deprecated. Use add method instead.
Add a non-leaf DataDir to a directory.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir

ddelDir

public final boolean ddelDir()
Deprecated. Use the delete method instead.
Remove a DataDir and its children from a directory.

dgetBits

public final String dgetBits()
Deprecated. Use the getBits method instead
Get a BITSTRING from a leaf DataDir.
Returns:
A String with 'y' for 1 bits and 'n' for 0 bits.

dgetChar

public final String dgetChar()
Deprecated. Use getString method instead.
Get a String from a leaf DataDir.
Returns:
String

dgetLong

public final long dgetLong()
Deprecated. Use the getLong method instead.
Get a LONG from a leaf DataDir.
Returns:
value of LONG data. Undefined if not a leaf DataDir or if leaf DataDir doesn't contain LONG data.

dgetNum

public final int dgetNum()
Deprecated. Use the getLong method instead.
Get an INTEGER from a leaf DataDir.
Returns:
value of INTEGER data. Undefined if not a leaf DataDir or if leaf DataDir doesn't contain INTEGER data.

dgetoid

public final String dgetoid()
Deprecated. Use the getOID method instead.
Get a human readable OID from a leaf DataDir.
Returns:
A String with human readable OID

dinsTag

public DataDir dinsTag(int fldid,
                       byte asn1class)
Deprecated. Use insertParent instead
Insert a new parent DataDir above this DataDir and all its siblings.
Parameters:
fldid - tag to be assigned to new DataDir
asn1class - class to be assigned to new DataDir

drepChar

public final void drepChar(String data)
Deprecated. Use replace method instead.
Replace the data contents with a new String
Parameters:
data - String reference

dreplaceDir

public final DataDir dreplaceDir(DataDir newdir)
Deprecated. Use the replace method instead.
Replace this dir with another
Parameters:
newdir - directory to replace this one with
Returns:
the new dir

dreplaceNum

public final DataDir dreplaceNum(int num)
Deprecated. Use the replace method instead.
Replace the data contents with an INTEGER value.
Parameters:
num - INTEGER

dtagFound

public final boolean dtagFound(int fldid,
                               byte asn1class)
Deprecated. Use the find and findNext methods instead.
Checks for existence of a particular DataDir in a directory.
Parameters:
fldid - tag of DataDir to be found
asn1class - class of DataDir to be found
Returns:
true if found, false if not found

dtagLocate

public final DataDir dtagLocate(int fldid,
                                byte asn1class)
Deprecated. Use the find and findNext methods instead.
Finds a particular DataDir in a directory.
Parameters:
fldid - tag of DataDir to be found
asn1class - class of DataDir to be found
Returns:
DataDir if found, null if not found

dtagLocate

public final DataDir dtagLocate(int fldid,
                                byte asn1class,
                                int occurrence)
Deprecated. Use the find and findNext methods instead.
Finds a the Nth particular DataDir in a directory.
Parameters:
fldid - tag of DataDir to be found
asn1class - class of DataDir to be found
occurrence - number of occrrences of the DataDir to be found
Returns:
DataDir if found, null if not found

integerData

public final int integerData()
Deprecated. Use getInt or getLong instead.
Get an INTEGER from a leaf DataDir. Does same thing as getInt()
Returns:
value of INTEGER data. Undefined if not a leaf DataDir or if leaf DataDir doesn't contain INTEGER data.
Throws:
java.lang.ArithmeticException - thrown when number is too large to fit into an int.

stringData

public final String stringData()
Deprecated. Use the getString method instead.
Get a String from a leaf DataDir. Does the same thing as dgetChar()
Returns:
String

setClass

public final void setClass(byte val)
Deprecated. see setClass(int)
Replace the asn1class with a new value
Parameters:
value -  

hasSameDataAs

public boolean hasSameDataAs(DataDir that)
Deprecated. Use dataEquals method instead.
Compares this DataDir's data array to the specified DataDir's data array. The result is true if and only if the argument is not null and is a DataDir that contains the same data array as this DataDir object.
Parameters:
that - - the DataDir to compare with.
Returns:
true if the object's data are the same; false otherwise.

isSameAs

public boolean isSameAs(DataDir that)
Deprecated. Use equals method instead.
Compares this DataDir to the specified DataDir. The result is true if and only if the argument is not null and is a DataDir object that contains the same nodes and data values as this DataDir object.
Parameters:
that - - the DataDir to compare with.
Returns:
true if the objects are the same; false otherwise.

getData

public String getData()
Locates the first primitive data node and returns the String data held at that location.
Returns:
String

getData

public String getData(int f)
Locates the primitive data node for the input fieldid and returns the String data held at that location.
Parameters:
f - the fieldid for the primitive node
Returns:
String

replaceData

public void replaceData(String subdata)
Locates the first primitive data node and replaces the data held at that location with the input data.
Parameters:
subdata - the string to store

findDataNode

public DataDir findDataNode()
Locates the first DataDir object for the first occurrence of a primitive data node where data is located.
Returns:
DataDir

findDataNode

public DataDir findDataNode(int f)
Locates the DataDir object for the primitive node matching the input fieldid.
Parameters:
f - the fieldid to locate
Returns:
DataDir

findNode

public DataDir findNode()

findNode

public DataDir findNode(int f)

Open SiteSearch 4.1.1
Final