You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rpc-dev@xml.apache.org by jo...@apache.org on 2002/03/08 06:19:29 UTC
cvs commit: xml-rpc/src/java/org/apache/xmlrpc XmlRpc.java
jon 02/03/07 21:19:29
Modified: src/java/org/apache/xmlrpc XmlRpc.java
Log:
made the write of the byte[] more efficient...thanks to martin for the idea
-jon
Revision Changes Path
1.21 +16 -2 xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java
Index: XmlRpc.java
===================================================================
RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XmlRpc.java 20 Feb 2002 02:40:55 -0000 1.20
+++ XmlRpc.java 8 Mar 2002 05:19:29 -0000 1.21
@@ -725,8 +725,7 @@
else if (obj instanceof byte[])
{
startElement("base64");
- // FIXME: Yucky! Find a better way!
- write(new String(Base64.encode((byte[]) obj)).toCharArray());
+ this.write(Base64.encode((byte[]) obj));
endElement("base64");
}
else if (obj instanceof Vector)
@@ -767,6 +766,18 @@
endElement("value");
}
+ /**
+ * This is used to write out the Base64 output...
+ */
+ protected void write(byte[] byteData)
+ throws IOException
+ {
+ for (int i=0;i<byteData.length;i++)
+ {
+ write(byteData[i]);
+ }
+ }
+
protected void startElement (String elem)
throws IOException
{
@@ -820,6 +831,7 @@
/**
* Wraps a <code>DateFormat</code> instance to provide thread safety.
+ * FIXME: this seems like a lot of sync overhead and could be done better...
*/
class Formatter
{
@@ -831,6 +843,8 @@
*/
public Formatter ()
{
+ // FIXME: this seems like a lot of overhead...shouldn't
+ // the instance also be declared as static?
f = new SimpleDateFormat ("yyyyMMdd'T'HH:mm:ss");
}