SF.net SVN: jrpm: [11] trunk/src/changes
[email protected] Thu, 02 Mar 2006 08:10:42 -0800
| Newsgroups | gmane.comp.java.jrpm.devel |
|---|---|
| Message-ID | <[email protected]> |
Revision: 11
Author: ymenager
Date: 2006-03-02 08:10:30 -0800 (Thu, 02 Mar 2006)
ViewCVS: http://svn.sourceforge.net/jrpm/?rev=11&view=rev
Log Message:
-----------
placeholder for XML support & small cleanup on IndexEntry
Modified Paths:
--------------
trunk/src/changes/changes.xml
trunk/src/java/com/jguild/jrpm/io/IndexEntry.java
trunk/src/java/com/jguild/jrpm/io/RPMFile.java
Modified: trunk/src/changes/changes.xml
===================================================================
--- trunk/src/changes/changes.xml 2006-03-02 15:24:43 UTC (rev 10)
+++ trunk/src/changes/changes.xml 2006-03-02 16:10:30 UTC (rev 11)
@@ -8,6 +8,9 @@
<action dev="ymenager" date="" type="add">
Check all TODOs have been done
</action>
+ <action dev="ymenager" date="" type="add">
+ RPM to/from XML
+ </action>
</release>
</body>
</document>
\ No newline at end of file
Modified: trunk/src/java/com/jguild/jrpm/io/IndexEntry.java
===================================================================
--- trunk/src/java/com/jguild/jrpm/io/IndexEntry.java 2006-03-02 15:24:43 UTC (rev 10)
+++ trunk/src/java/com/jguild/jrpm/io/IndexEntry.java 2006-03-02 16:10:30 UTC (rev 11)
@@ -4,14 +4,13 @@
*/
package com.jguild.jrpm.io;
+import com.jguild.jrpm.io.constant.RPMIndexType;
+
import java.io.DataInputStream;
import java.io.IOException;
-
-import java.util.logging.Logger;
import java.util.logging.Level;
+import java.util.logging.Logger;
-import com.jguild.jrpm.io.constant.RPMIndexType;
-
/**
* RPM Index Entry (16 byte).
* <p/>
@@ -127,7 +126,7 @@
* @param test A boolean test variable
* @throws IOException if the variable test is false
*/
- private static final void check(boolean test) throws IOException {
+ private static void check(boolean test) throws IOException {
if (!test) {
throw new IOException("Corrupted archive");
}
Modified: trunk/src/java/com/jguild/jrpm/io/RPMFile.java
===================================================================
--- trunk/src/java/com/jguild/jrpm/io/RPMFile.java 2006-03-02 15:24:43 UTC (rev 10)
+++ trunk/src/java/com/jguild/jrpm/io/RPMFile.java 2006-03-02 16:10:30 UTC (rev 11)
@@ -376,6 +376,51 @@
reset();
}
+ /**
+ * Same as doing toXML(true).
+ *
+ * @return String containing the XML representation of this RPM.
+ * @see #toXML(boolean)
+ */
+ public String toXML() {
+ StringWriter buf = new StringWriter();
+ try {
+ toXML(buf, true);
+ buf.flush();
+ return buf.toString();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns an XML version of this file
+ *
+ * @param excludePayload If this is true, the payload will not be included in the XML.
+ * @return XML rpm.
+ */
+ public String toXML(boolean excludePayload) {
+ StringWriter buf = new StringWriter();
+ try {
+ toXML(buf, excludePayload);
+ buf.flush();
+ return buf.toString();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Outputs this rpm in an XML format to the specified i/o writer.
+ *
+ * @param writer Writer stream.
+ * @param excludePayload If this is true, the payload will not be included in the XML.
+ * @throws IOException If an error occurred writing to the writer.
+ */
+ public void toXML(Writer writer, boolean excludePayload) throws IOException {
+ // TODO
+ }
+
private class ByteCountInputStream extends FilterInputStream {
private int count = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642