|
Open SiteSearch 4.1.1 Final |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ORG.oclc.ber.ASN1 | +--ORG.oclc.ber.DataDir
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 }
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 |
public int fldid
public int asn1class
public Object obj
Constructor Detail |
protected DataDir()
public DataDir(int fldid, byte asn1class)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirpublic DataDir(int fldid, int asn1class)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirpublic DataDir(int fldid, int asn1class, long num)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirobj
- data to be put into the new DataDirpublic DataDir(int fldid, int asn1class, Object obj)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirobj
- data to be put into the new DataDirpublic DataDir(DataDir parent_dir, int fldid, byte asn1class)
fldid
- tag to be assigned to new nodeasn1class
- class to be assigned to new nodepublic DataDir(DataDir parent_dir, int fldid, int asn1class)
fldid
- tag to be assigned to new nodeasn1class
- class to be assigned to new nodepublic DataDir(BerString record)
record
- BER recordMethod Detail |
public final DataDir add(DataDir newdir)
newdir
- DataDir to be addedpublic final DataDir add(DataDir newdir, int offset)
newdir
- DataDir to be addedoffset
- 0=first child; >0 = position; >number of children = lastpublic DataDir add(int fldid, int asn1class)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirpublic final DataDir add(int fldid, int asn1class, byte[] data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirdata
- String referencepublic final DataDir add(int fldid, int asn1class, byte[] data, int offset, int len)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbyte[]
- data array containing bytes to be addedint
- offset into arrayint
- len of data to be addedpublic final DataDir add(int fldid, int asn1class, int num)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirnum
- int to be addedpublic final DataDir add(int fldid, int asn1class, long num)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirnum
- long to be addedpublic DataDir add(int fldid, int asn1class, DataDirObject obj)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirobj
- DataDirObject to be addedpublic final DataDir add(int fldid, int asn1class, String data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirdata
- String to be addedpublic final DataDir add(int fldid, int asn1class, String data, String enc) throws UnsupportedEncodingException
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirdata
- String to be addedenc
- byte encoding to useString.getBytes()
public final DataDir addBits(int fldid, int asn1class, String bits)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbits
- String containing array of bits.public final DataDir addOID(int fldid, int asn1class, String OID)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDircstring
- String containing human readable OIDpublic final DataDir addUTF(int fldid, int asn1class, String data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirdata
- String to be addedpublic final void asmRec(BerString record)
record
- object to hold BER recordpublic final Object clone()
public final Object clone(boolean doSibs)
doSibs
- true = clone siblings; false = do not clone siblingspublic boolean dataEquals(DataDir that)
that
- - the DataDir to compare with.public final void delete()
public DataDir diff(DataDir that)
that
- public boolean equals(DataDir that)
that
- - the DataDir to compare with.public final DataDir find(int fldid)
fldid
- tag of DataDir to be foundpublic final DataDir find(int fldid, int asn1class)
fldid
- tag of DataDir to be foundasn1class
- class of DataDir to be foundpublic final DataDir find(int fldid, int asn1class, int occurrence)
fldid
- tag of DataDir to be foundasn1class
- class of DataDir to be foundoccurrence
- number of occrrences of the DataDir to be foundpublic final DataDir findNext(int fldid, int asn1class)
fldid
- tag of DataDir to be foundasn1class
- class of DataDir to be foundpublic final String getBits()
public final byte[] getBytes()
public final int getInt()
public final long getLong()
public final String getOID()
public final String getString()
public final String getString(String enc) throws UnsupportedEncodingException
enc
- String containing byte encoding.String
public final String getUTFString()
public DataDir insertAfter(DataDir newDir)
newDir
- new tree to be inserted after this node.public DataDir insertBefore(DataDir newDir)
newDir
- new tree to be inserted before this node.public DataDir insertParent(int fldid, int asn1class)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirpublic final int recLen()
public final void replace(DataDir newdir)
newdir
- directory to replace this one withpublic final void replace(DataDirObject obj)
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.
obj
- object reference to added to DataDirpublic final void replace(int num)
num
- INTEGERpublic final void replace(long num)
num
- LONGpublic final void replace(String data)
data
- String referencepublic final void replace(byte[] data)
data
- byte[]public final DataDir replaceDir(DataDir newdir)
newdir
- directory to replace this one withpublic final void replaceUTF(String data)
data
- String referencepublic final void setClass(int val)
value
- public final void setFldid(int fldid)
fldid
- to change the node to.public final void print()
public final String toString()
public void writeToFile(String filename)
filename
- - name of the file to write.public void writeToFile(String filename, boolean append)
filename
- - name of the file to write.append
- - boolean indicating whether or not append the file.BerString
,
FileOutputStream
,
BufferOutputStream
public final DataDir child()
public final DataDir subElement()
public final DataDir parent()
public final DataDir next()
public final DataDir nextElement()
public final DataDir prev()
public final DataDir prevElement()
public final DataDirObject object()
public final void data(byte[] dest, int offset, int length)
public final byte[] data()
public final int fldid()
public final byte asn1class()
public final byte form()
public final int count()
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.
public final void resetNext()
public final void resetPrev()
public final void resetChild()
public final void resetParent()
public final DataDir daddBits(int fldid, byte asn1class, String bits)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbits
- String containing array of bits.public final DataDir daddBytes(int fldid, byte asn1class, byte[] data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbyte[]
- datapublic final DataDir daddBytes(int fldid, byte asn1class, byte[] data, int offset, int len)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbyte[]
- dataint
- offsetint
- lenpublic final DataDir daddChar(int fldid, byte asn1class, byte[] data, int offset, int len)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbyte[]
- dataint
- offsetint
- lenpublic final DataDir daddChar(int fldid, byte asn1class, byte[] data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirbyte[]
- datapublic final DataDir daddChar(int fldid, byte asn1class, String data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirdata
- String referencepublic final DataDir daddDir(DataDir newdir)
newdir
- directory to be addedpublic final DataDir daddDir(DataDir newdir, int offset)
newdir
- directory to be addedoffset
- 0=first child; >0 = position; >number of children = lastpublic final DataDir daddNum(int fldid, byte asn1class, int num)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirnum
- INTEGERpublic final DataDir daddNum(int fldid, byte asn1class, long num)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirnum
- LONGpublic void daddObj(DataDirObject obj)
obj
- object reference to added to DataDirpublic DataDir daddObj(int fldid, byte asn1class, DataDirObject obj)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirobj
- object referencepublic final DataDir daddoid(int fldid, byte asn1class, String OID)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirOID
- String containing human readable OIDpublic final DataDir daddString(int fldid, byte asn1class, String data)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirdata
- String referencepublic DataDir daddTag(int fldid, byte asn1class)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirpublic final boolean ddelDir()
public final String dgetBits()
public final String dgetChar()
public final long dgetLong()
public final int dgetNum()
public final String dgetoid()
public DataDir dinsTag(int fldid, byte asn1class)
fldid
- tag to be assigned to new DataDirasn1class
- class to be assigned to new DataDirpublic final void drepChar(String data)
data
- String referencepublic final DataDir dreplaceDir(DataDir newdir)
newdir
- directory to replace this one withpublic final DataDir dreplaceNum(int num)
num
- INTEGERpublic final boolean dtagFound(int fldid, byte asn1class)
fldid
- tag of DataDir to be foundasn1class
- class of DataDir to be foundpublic final DataDir dtagLocate(int fldid, byte asn1class)
fldid
- tag of DataDir to be foundasn1class
- class of DataDir to be foundpublic final DataDir dtagLocate(int fldid, byte asn1class, int occurrence)
fldid
- tag of DataDir to be foundasn1class
- class of DataDir to be foundoccurrence
- number of occrrences of the DataDir to be foundpublic final int integerData()
public final String stringData()
public final void setClass(byte val)
value
- public boolean hasSameDataAs(DataDir that)
that
- - the DataDir to compare with.public boolean isSameAs(DataDir that)
that
- - the DataDir to compare with.public String getData()
public String getData(int f)
f
- the fieldid for the primitive nodepublic void replaceData(String subdata)
subdata
- the string to storepublic DataDir findDataNode()
public DataDir findDataNode(int f)
f
- the fieldid to locatepublic DataDir findNode()
public DataDir findNode(int f)
|
Open SiteSearch 4.1.1 Final |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |