protected void initHandler() { //set Value Handler . setchildelement(new ValueXMLhandler(this)); } protected void endElement() {
protected void endElement() { try { byte[] temp; String name = getName(); String value = getValue(); if (this.isBase64) { temp = Base64.decode(value); } else { temp = value.getBytes("UTF-8"); } //getParent().addValue("value", temp); getParent().addValue(name, temp); } catch (UnsupportedEncodingException e) { } } protected void handleAttributes(Attributes attributes) throws SAXException {
protected void writeValue(StringBuffer buff){ String value = formatString(); buff.append(ValueXMLhandler.newLine(2)); buff.append("<value>"); buff.append(value); buff.append("</value>"); }
/** * This mehod separates whitespaces in non-text nodes during XML de-serialization. * The whitespaces are added in non-text nodes because of XML doc written during * Serialization needs to be stored with proper indentation. * @param whole The XML String with whitespaces in non-text nodes read from stream * during de-serialization * @param buffer StringBuffer which holds the resulting string after removal of * unwanted whitespaces in non-text nodes */ public static void parseInput(String whole, StringBuffer buffer){ String token, part; int start, end; start = whole.indexOf('<'); if(start != -1) { //if Index of start is not '<' if(start > 0) start = 0; end = whole.indexOf('>'); token = whole.substring(start, end + 1); buffer.append(token); part = whole.substring(end + 1).trim(); parseInput(part, buffer); } return; }
/** * Reads the serialized object from the underlying input stream. * @param in The ObjectInput stream where the Serialized Object is being read from * @throws IOException - If I/O errors occur * @throws ClassNotFoundException - If the class for an object being restored * cannot be found. */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { String readData = in.readUTF(); String readProperties = readData.substring(readData.indexOf('<'), (readData.lastIndexOf('>') + 1)); //Insert parsing logic here for separating whitespace text nodes StringBuffer parsedBuff = new StringBuffer(); ValueXMLhandler.parseInput(readProperties, parsedBuff); BufferedInputStream istream = new BufferedInputStream( new ByteArrayInputStream((parsedBuff.toString()).getBytes())); // Sub classes need to override this method setDeserializedValues(istream); // Close the DSML reader stream istream.close(); }
protected void writeValue(java.io.Writer out) throws IOException { String value = formatString(); out.write(ValueXMLhandler.newLine(2)); out.write("<value>"); out.write(value); out.write("</value>"); }
protected void initHandler() { //set value handler. setchildelement(new ValueXMLhandler(this)); }
/** * Reads the serialized object from the underlying input stream. * @param in The ObjectInput stream where the Serialized Object is being read from * @throws IOException - If I/O errors occur * @throws ClassNotFoundException - If the class for an object being restored * cannot be found. */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { String readData = in.readUTF(); String readProperties = readData.substring(readData.indexOf('<'), (readData.lastIndexOf('>') + 1)); //Insert parsing logic here for separating whitespaces in non-text nodes StringBuffer parsedBuff = new StringBuffer(); ValueXMLhandler.parseInput(readProperties, parsedBuff); BufferedInputStream istream = new BufferedInputStream( new ByteArrayInputStream((parsedBuff.toString()).getBytes())); LDAPUrl readObject = (LDAPUrl)LDAPUrl.readDSML(istream); this.parseURL( readObject.toString() ); //Garbage collect the readObject from readDSML().. readObject = null; }
protected void writeValue(StringBuffer buff){ String value = formatString(); buff.append(ValueXMLhandler.newLine(2)); buff.append("<value>"); buff.append(value); buff.append("</value>"); }
protected void initHandler() { //set value handler. setchildelement(new ValueXMLhandler(this)); }
ValueXMLhandler.parseInput(readProperties, parsedBuff);
protected void writeValue(StringBuffer buff){ String value = formatString(); buff.append(ValueXMLhandler.newLine(2)); buff.append("<value>"); buff.append(value); buff.append("</value>"); }
protected void initHandler() { //set value handler. setchildelement(new ValueXMLhandler(this)); }
/** * Reads the serialized object from the underlying input stream. * @param in The ObjectInput stream where the Serialized Object is being read from * @throws IOException - If I/O errors occur * @throws ClassNotFoundException - If the class for an object being restored * cannot be found. */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { String readData = in.readUTF(); String readProperties = readData.substring(readData.indexOf('<'), (readData.lastIndexOf('>') + 1)); //Insert parsing logic here for separating whitespaces in non-text nodes StringBuffer parsedBuff = new StringBuffer(); ValueXMLhandler.parseInput(readProperties, parsedBuff); BufferedInputStream istream = new BufferedInputStream( new ByteArrayInputStream((parsedBuff.toString()).getBytes())); LDAPModification readObject = (LDAPModification)LDAPModification.readDSML(istream); this.op = readObject.getOp(); this.attr = readObject.getAttribute(); //Garbage collect the readObject from readDSML().. readObject = null; }
protected void writeValue(java.io.Writer out) throws IOException { String value = formatString(); out.write(ValueXMLhandler.newLine(2)); out.write("<value>"); out.write(value); out.write("</value>"); }
protected void initHandler() { //set value handler. setchildelement(new ValueXMLhandler(this)); }
ValueXMLhandler.parseInput(readProperties, parsedBuff);
protected void writeValue(java.io.Writer out) throws IOException { String value = formatString(); out.write(ValueXMLhandler.newLine(2)); out.write("<value>"); out.write(value); out.write("</value>"); }
protected void initHandler() { //set value handler. setchildelement(new ValueXMLhandler("controlValue", this)); }
ValueXMLhandler.parseInput(readData, parsedBuff);