All Packages Class Hierarchy This Package Previous Next Index
Class ORG.oclc.ber.DataDir
java.lang.Object
|
+----ORG.oclc.ber.ASN1
|
+----ORG.oclc.ber.DataDir
- 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.daddTag(DBI.BEGINS, ASN1.CONTEXT); // make it a Begin Session
subdir.daddChar(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.dgetNum();
break;
}
subdir = subdir.next(); // point to sibling of this node
}
- Version:
- %W% %G%
- See Also:
- ASN1
-
DataDir(BerString)
- Builds a DataDir tree structure for a BER record.
-
DataDir(DataDir, int, byte)
- Create a non-leaf node that will be a child of the specified parent.
-
DataDir(int, byte)
- Create a DataDir node with the specified fldid and asn1class.
-
asmRec(BerString)
- Assembles a BER record from a DataDir into a BerString object.
-
asn1class()
- Accessor method for asn1class for this DataDir.
-
child()
- Accessor method for child of this DataDir.
-
clone()
- Clone the DataDir and all it's children and siblings.
-
count()
- Accessor method for count for this DataDir.
-
daddBits(int, byte, String)
- Add a leaf node which contains a BITSTRING to a directory.
-
daddChar(int, byte, byte[])
- Add a leaf node to the directory with byte[] data.
-
daddChar(int, byte, byte[], int, int)
- Add a leaf node to the directory with byte[] data.
-
daddChar(int, byte, String)
- Add a leaf node to the directory with String data.
-
daddDir(DataDir)
- Attach one directory to another.
-
daddNum(int, byte, int)
- Add a leaf node to the directory with INTEGER data.
-
daddObj(DataDirObject)
- Remove the reference to any data and create a reference to the specified
DataDirObject.
-
daddObj(int, byte, DataDirObject)
- Add a leaf node to the directory with DataDirObject data.
-
daddoid(int, byte, String)
- Add a leaf node to a directory which contains an OID.
-
daddTag(int, byte)
- Add a non-leaf node to a directory.
-
data()
-
-
data(byte[], int, int)
- Accessor method for data for this DataDir.
-
ddelDir()
- Remove a node and its children from a directory.
-
dgetBits()
- Get a BITSTRING from a leaf node.
-
dgetChar()
- Get a String from a leaf node.
-
dgetNum()
- Get an INTEGER from a leaf node.
-
dgetoid()
- Get a human readable OID from a leaf node.
-
dinsTag(int, byte)
- Insert a new tag before an existing dir and all its siblings.
-
drepChar(String)
- Replace the data contents with a new String
-
dreplaceNum(int)
- Replace the data contents with an INTEGER value.
-
dtagFound(int, byte)
- Checks for existence of a particular node in a directory.
-
fldid()
- Accessor method for fldid for this DataDir.
-
form()
- Accessor method for form for this DataDir.
-
free()
-
-
newDataDir(BerString)
- Builds a DataDir tree structure for a BER record.
-
newDataDir(int, byte)
-
-
next()
- Accessor method for next sibling of this DataDir.
-
object()
- Accessor method for DataDirObject for this DataDir.
-
parent()
- Accessor method for parent of this DataDir.
-
prev()
- Accessor method for previous sibling of this DataDir.
-
recLen()
- Returns the length of the BER record that would be created from the
directory.
-
toString()
- Produce a formatted hex dump of a directory.
DataDir
public DataDir(int fldid,
byte asn1class)
- Create a DataDir node with the specified fldid and asn1class.
- 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,
byte 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)
- Builds a DataDir tree structure for a BER record.
- Parameters:
- record - BER record
free
public void free()
child
public final DataDir child()
- Accessor method for child of this DataDir.
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.
prev
public final DataDir prev()
- Accessor method for previous sibling of this DataDir.
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()
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.
toString
public final String toString()
- Produce a formatted hex dump of a directory.
- Returns:
- String
- Overrides:
- toString in class Object
newDataDir
public static DataDir newDataDir(int fldid,
byte asn1class)
daddTag
public DataDir daddTag(int fldid,
byte asn1class)
- Add a non-leaf node to a directory.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
dinsTag
public DataDir dinsTag(int fldid,
byte asn1class)
- Insert a new tag before an existing dir and all its siblings.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
newDataDir
public static DataDir newDataDir(BerString record)
- Builds a DataDir tree structure for a BER record.
- Parameters:
- record - BER record
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
daddObj
public void daddObj(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
daddObj
public DataDir daddObj(int fldid,
byte asn1class,
DataDirObject obj)
- Add a leaf node to the directory with DataDirObject data.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
- obj - object reference
daddChar
public final DataDir daddChar(int fldid,
byte asn1class,
String input_data)
- Add a leaf node to the directory with String data. The data will be
converted to a byte array.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
- input_data - String reference
drepChar
public final void drepChar(String input_data)
- Replace the data contents with a new String
- Parameters:
- input_data - String reference
daddChar
public final DataDir daddChar(int fldid,
byte asn1class,
byte dataSource[])
- Add a leaf node to the directory with byte[] data.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
- byte[] - dataSource
daddChar
public final DataDir daddChar(int fldid,
byte asn1class,
byte dataSource[],
int dataOffset,
int dataLength)
- Add a leaf node to the directory with byte[] data.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
- byte[] - dataSource
- int - dataOffset
- int - dataLength
daddNum
public final DataDir daddNum(int fldid,
byte asn1class,
int num)
- Add a leaf node to the directory with INTEGER data.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
- num - INTEGER
dreplaceNum
public final DataDir dreplaceNum(int num)
- Replace the data contents with an INTEGER value.
- Parameters:
- num - INTEGER
daddBits
public final DataDir daddBits(int fldid,
byte asn1class,
String bits)
- Add a leaf node 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 node
- asn1class - class to be assigned to new node
- bits - String containing array of bits.
daddoid
public final DataDir daddoid(int fldid,
byte asn1class,
String cstring)
- Add a leaf node to a directory which contains an OID.
- Parameters:
- fldid - tag to be assigned to new node
- asn1class - class to be assigned to new node
- cstring - String containing human readable OID
recLen
public final int recLen()
- Returns the length of the BER record that would be created from the
directory.
- Returns:
- length of record that would be created by asmRec().
dgetChar
public final String dgetChar()
- Get a String from a leaf node.
- Returns:
- String
dgetNum
public final int dgetNum()
- Get an INTEGER from a leaf node.
- Returns:
- value of INTEGER data. Undefined if not a leaf node or if leaf
node doesn't contain INTEGER data.
dgetoid
public final String dgetoid()
- Get a human readable OID from a leaf node.
- Returns:
- A String with human readable OID
dgetBits
public final String dgetBits()
- Get a BITSTRING from a leaf node.
- Returns:
- A String with 'y' for 1 bits and 'n' for 0 bits.
daddDir
public final DataDir daddDir(DataDir newdir)
- Attach one directory to another.
- Parameters:
- newdir - directory to be added
ddelDir
public final boolean ddelDir()
- Remove a node and its children from a directory.
dtagFound
public final boolean dtagFound(int fldid,
byte asn1class)
- Checks for existence of a particular node in a directory.
- Parameters:
- fldid - tag of node to be found
- asn1class - class of node to be found
- Returns:
- true if found, false if not found
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
All Packages Class Hierarchy This Package Previous Next Index