/** * 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(); }
/** * 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; }
/** * 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; }
ValueXMLhandler.parseInput(readProperties, parsedBuff);
ValueXMLhandler.parseInput(readProperties, parsedBuff);
ValueXMLhandler.parseInput(readData, parsedBuff);
ValueXMLhandler.parseInput(readData, parsedBuff);
ValueXMLhandler.parseInput(readProperties, parsedBuff);
ValueXMLhandler.parseInput(readProperties, parsedBuff);