[jboss-svn-commits] JBL Code SVN: r6294 - in labs/jbossesb/workspace/rearchitecture/product: core/rosetta/src/org/jboss/internal/soa/esb/addressing core/rosetta/src/org/jboss/soa/esb/addressing lib/ext
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 19 08:36:19 EDT 2006
Author: mark.little at jboss.com
Date: 2006-09-19 08:36:14 -0400 (Tue, 19 Sep 2006)
New Revision: 6294
Added:
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java
Removed:
labs/jbossesb/workspace/rearchitecture/product/lib/ext/ReadMe.html
Modified:
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
Log:
moved XML serialization from Call.
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java 2006-09-19 12:00:55 UTC (rev 6293)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java 2006-09-19 12:36:14 UTC (rev 6294)
@@ -0,0 +1,193 @@
+package org.jboss.internal.soa.esb.addressing;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+import org.jboss.internal.soa.esb.addressing.PortReferenceHelper;
+
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.XMLUtil;
+import org.jboss.soa.esb.addressing.EPR;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * A call represents an exchange pattern for this message. It is built up as the message
+ * flows through the ESB and identifies where the message should go, along with any
+ * routing information for faults, replies etc.
+ */
+
+import java.net.URI;
+
+public class CallHelper
+{
+
+ public static Element toXML (Call call, Document doc, Element header)
+ {
+ try
+ {
+ Element toElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG);
+ PortReferenceHelper.toXML(header, doc, toElement, call.getTo().getAddr(), true);
+ header.appendChild(toElement);
+
+ Element fromElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG);
+ PortReferenceHelper.toXML(header, doc, fromElement, call.getFrom().getAddr(), false);
+ header.appendChild(fromElement);
+
+ Element replyToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG);
+ PortReferenceHelper.toXML(header, doc, replyToElement, call.getReplyTo().getAddr(), false);
+ header.appendChild(replyToElement);
+
+ Element relatesToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG);
+ PortReferenceHelper.toXML(header, doc, relatesToElement, call.getRelatesTo().getAddr(), false);
+ header.appendChild(relatesToElement);
+
+ Element faultToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG);
+ PortReferenceHelper.toXML(header, doc, faultToElement, call.getFaultTo().getAddr(), false);
+ header.appendChild(faultToElement);
+
+ Element actionElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG);
+ actionElement.setNodeValue(call.getAction().toString());
+ header.appendChild(actionElement);
+
+ Element messageIDElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG);
+ messageIDElement.setNodeValue(call.getMessageID().toString());
+ header.appendChild(messageIDElement);
+
+ return header;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ }
+
+ public static Call fromXML (Element header)
+ {
+ try
+ {
+ Call call = new Call();
+
+ NodeList nl = header.getChildNodes();
+
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG))
+ {
+ try
+ {
+ call.setTo(new EPR(PortReferenceHelper.fromXML((Element) n, true)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG))
+ {
+ try
+ {
+ call.setFrom(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG))
+ {
+ try
+ {
+ call.setReplyTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG))
+ {
+ try
+ {
+ call.setRelatesTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG))
+ {
+ try
+ {
+ call.setFaultTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG))
+ {
+ try
+ {
+ call.setAction(new URI(n.getNodeValue()));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG))
+ {
+ try
+ {
+ call.setMessageID(new URI(n.getNodeValue()));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ // TODO error checking!!
+
+ ex.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
Modified: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2006-09-19 12:00:55 UTC (rev 6293)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2006-09-19 12:36:14 UTC (rev 6294)
@@ -21,14 +21,7 @@
* @author mark.little at jboss.com
*/
-import org.jboss.soa.esb.addressing.PortReference.Extension;
-import org.jboss.internal.soa.esb.addressing.PortReferenceHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
/**
* A call represents an exchange pattern for this message. It is built up as the message
* flows through the ESB and identifies where the message should go, along with any
@@ -146,152 +139,6 @@
return "To: "+_to+" From: "+_from+" ReplyTo: "+_replyTo+" FaultTo: "+_faultTo+" Action: "+_action;
}
-
- public Element toXML (Document doc, Element header)
- {
- try
- {
- Element toElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG);
- PortReferenceHelper.toXML(header, doc, toElement, _to.getAddr(), true);
- header.appendChild(toElement);
-
- Element fromElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG);
- PortReferenceHelper.toXML(header, doc, fromElement, _from.getAddr(), false);
- header.appendChild(fromElement);
-
- Element replyToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG);
- PortReferenceHelper.toXML(header, doc, replyToElement, _replyTo.getAddr(), false);
- header.appendChild(replyToElement);
-
- Element relatesToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG);
- PortReferenceHelper.toXML(header, doc, relatesToElement, _relatesTo.getAddr(), false);
- header.appendChild(relatesToElement);
-
- Element faultToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG);
- PortReferenceHelper.toXML(header, doc, faultToElement, _faultTo.getAddr(), false);
- header.appendChild(faultToElement);
-
- Element actionElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG);
- actionElement.setNodeValue(_action.toString());
- header.appendChild(actionElement);
-
- Element messageIDElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG);
- messageIDElement.setNodeValue(_messageID.toString());
- header.appendChild(messageIDElement);
-
- return header;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- }
-
- public void fromXML (Element header)
- {
- try
- {
- NodeList nl = header.getChildNodes();
-
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG))
- {
- try
- {
- _to = new EPR(PortReferenceHelper.fromXML((Element) n, true));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG))
- {
- try
- {
- _from = new EPR(PortReferenceHelper.fromXML((Element) n, false));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG))
- {
- try
- {
- _replyTo = new EPR(PortReferenceHelper.fromXML((Element) n, false));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG))
- {
- try
- {
- _relatesTo = new EPR(PortReferenceHelper.fromXML((Element) n, false));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG))
- {
- try
- {
- _faultTo = new EPR(PortReferenceHelper.fromXML((Element) n, false));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG))
- {
- try
- {
- _action = new URI(n.getNodeValue());
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG))
- {
- try
- {
- _messageID = new URI(n.getNodeValue());
- }
- catch (Exception ex)
- {
-
- }
- }
- }
- }
- catch (Exception ex)
- {
- // TODO error checking!!
-
- ex.printStackTrace();
- }
- }
-
private EPR _to;
private EPR _from;
private EPR _faultTo;
Modified: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2006-09-19 12:00:55 UTC (rev 6293)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2006-09-19 12:36:14 UTC (rev 6294)
@@ -32,7 +32,6 @@
import java.util.LinkedList;
import java.util.HashMap;
-
/**
* An implementation of a WS-Addressing EPR. It needs completely rewriting after
* the interoperability workshop as it is not extensible and not guaranteed to
@@ -44,35 +43,43 @@
* An instance of a PortReference represents a single element in WS-A.
*/
-public class PortReference {
- public PortReference() {
+public class PortReference
+{
+ public PortReference()
+ {
}
- public PortReference(String address) {
+ public PortReference(String address)
+ {
setAddress(address);
}
- public void setAddress(String address) {
+ public void setAddress(String address)
+ {
_address = address;
}
- public String getAddress() {
+ public String getAddress()
+ {
return _address;
}
- public void addExtension(PortReference.Extension extension) {
+ public void addExtension(PortReference.Extension extension)
+ {
_extensions.add(extension);
}
// all extensions are added as the Arjuna namespace.
- public void addExtension(String value) {
+ public void addExtension(String value)
+ {
addExtension(XMLUtil.INSTANCE_IDENTIFIER_TAG, XMLUtil.WSARJADDR_PREFIX,
XMLUtil.WSARJADDR_NAMESPACE_URI, value,
Extension.REFERENCE_PROPERTIES);
}
- public void addExtension(String tag, String value) {
+ public void addExtension(String tag, String value)
+ {
addExtension(tag, XMLUtil.WSARJADDR_PREFIX,
XMLUtil.WSARJADDR_NAMESPACE_URI, value,
Extension.REFERENCE_PROPERTIES);
@@ -83,7 +90,8 @@
* parent is a refProperty.
*/
- public void addExtension(String tag, String prefix, String uri, String value) {
+ public void addExtension(String tag, String prefix, String uri, String value)
+ {
_extensions.add(new Extension(tag, prefix, uri, value,
Extension.REFERENCE_PROPERTIES));
}
@@ -95,26 +103,32 @@
*/
public void addExtension(String tag, String prefix, String uri,
- String value, int parent) {
+ String value, int parent)
+ {
_extensions.add(new Extension(tag, prefix, uri, value, parent));
}
// placeholders only
- public void addPortType(String qName) {
+ public void addPortType(String qName)
+ {
}
- public void addServiceName(String portName, String qName) {
+ public void addServiceName(String portName, String qName)
+ {
}
- public void addPolicy() {
+ public void addPolicy()
+ {
}
- public String getExtensionValue(String tag) {
+ public String getExtensionValue(String tag)
+ {
String extensionValue = null;
Iterator iterator = _extensions.iterator();
- while (iterator.hasNext() && (extensionValue == null)) {
+ while (iterator.hasNext() && (extensionValue == null))
+ {
Extension extension = (Extension) iterator.next();
if (tag.equals(extension.getTag()))
@@ -124,24 +138,29 @@
return extensionValue;
}
- public Iterator getExtensions() {
+ public Iterator getExtensions()
+ {
return _extensions.iterator();
}
- public void clearExtensions() {
+ public void clearExtensions()
+ {
_extensions.clear();
}
- public String toString() {
+ public String toString()
+ {
return "PortReference < " + _address + " >";
}
- public String extendedToString() {
+ public String extendedToString()
+ {
String addr = "<" + XMLUtil.WSA_PREFIX + ":Address " + _address + "/>";
Iterator extensions = getExtensions();
- while (extensions.hasNext()) {
+ while (extensions.hasNext())
+ {
Extension ext = (Extension) extensions.next();
addr += ", <" + XMLUtil.WSA_PREFIX + ":"
@@ -159,8 +178,10 @@
* The rhs object.
* @return true if the specified object is equal, false otherwise.
*/
- public boolean equals(final Object rhs) {
- if ((rhs != null) && (rhs.getClass() == getClass())) {
+ public boolean equals(final Object rhs)
+ {
+ if ((rhs != null) && (rhs.getClass() == getClass()))
+ {
// This should really only include reference property extensions
final PortReference rhsPortReference = (PortReference) rhs;
return (equalsObject(_address, rhsPortReference._address)
@@ -177,7 +198,8 @@
*
* @return the hash code value.
*/
- public int hashCode() {
+ public int hashCode()
+ {
// Not checked for spread.
return (objectHashCode(_address, 0x1)
^ objectHashCode(_extensions, 0x2)
@@ -186,21 +208,27 @@
0x10));
}
- public static class Extension {
+ public static class Extension
+ {
public static final int REFERENCE_PROPERTIES = 0;
+
public static final int REFERENCE_PARAMETERS = 1;
+
public static final int NEITHER = 2;
- public Extension(String tag, String prefix, String uri) {
+ public Extension(String tag, String prefix, String uri)
+ {
this(tag, prefix, uri, null, REFERENCE_PROPERTIES);
}
- public Extension(String tag, String prefix, String uri, String value) {
+ public Extension(String tag, String prefix, String uri, String value)
+ {
this(tag, prefix, uri, value, REFERENCE_PROPERTIES);
}
public Extension(String tag, String prefix, String uri, String value,
- int parent) {
+ int parent)
+ {
_tag = tag;
_prefix = prefix;
_uri = uri;
@@ -208,46 +236,56 @@
_parent = parent;
}
- public int getParent() {
+ public int getParent()
+ {
return _parent;
}
- public String getTag() {
+ public String getTag()
+ {
return _tag;
}
- public String getPrefix() {
+ public String getPrefix()
+ {
return _prefix;
}
- public String getURI() {
+ public String getURI()
+ {
return _uri;
}
- public String getValue() {
+ public String getValue()
+ {
return _value;
}
- public LinkedList getChildren() {
+ public LinkedList getChildren()
+ {
return _extensions;
}
- public HashMap getAttributes() {
+ public HashMap getAttributes()
+ {
return _attributes;
}
- public void addAttributes(HashMap props) {
+ public void addAttributes(HashMap props)
+ {
_attributes = props;
}
- public void addChild(Extension child) {
+ public void addChild(Extension child)
+ {
if (_extensions == null)
_extensions = new LinkedList();
_extensions.add(child);
}
- public String toString() {
+ public String toString()
+ {
return new String("< " + _tag + ", " + _prefix + ", " + _uri + ", "
+ _value + " >");
}
@@ -259,8 +297,10 @@
* The rhs object.
* @return true if the specified object is equal, false otherwise.
*/
- public boolean equals(final Object rhs) {
- if ((rhs != null) && (rhs.getClass() == getClass())) {
+ public boolean equals(final Object rhs)
+ {
+ if ((rhs != null) && (rhs.getClass() == getClass()))
+ {
final Extension rhsExtension = (Extension) rhs;
return (equalsObject(_tag, rhsExtension._tag)
&& equalsObject(_uri, rhsExtension._uri)
@@ -275,7 +315,8 @@
*
* @return the hash code value.
*/
- public int hashCode() {
+ public int hashCode()
+ {
// Not checked for spread.
return (_parent ^ objectHashCode(_tag, 0x4)
^ objectHashCode(_uri, 0x8) ^ objectHashCode(_value, 0x10) ^ objectHashCode(
@@ -283,11 +324,17 @@
}
private String _tag = null;
+
private String _prefix = null;
+
private String _uri = null;
+
private String _value = null;
+
private int _parent = NEITHER;
+
private LinkedList _extensions = null;
+
private HashMap _attributes = null;
}
@@ -301,7 +348,8 @@
* The default hash code.
* @return The hash code.
*/
- static int objectHashCode(final Object obj, final int defaultHashCode) {
+ static int objectHashCode(final Object obj, final int defaultHashCode)
+ {
return (obj == null ? defaultHashCode : obj.hashCode());
}
@@ -314,10 +362,13 @@
* The rhs object.
* @return true if equal or both null, false otherwise.
*/
- static boolean equalsObject(final Object lhs, final Object rhs) {
- if (lhs == null) {
+ static boolean equalsObject(final Object lhs, final Object rhs)
+ {
+ if (lhs == null)
+ {
return (rhs == null);
- } else {
+ } else
+ {
return lhs.equals(rhs);
}
}
Deleted: labs/jbossesb/workspace/rearchitecture/product/lib/ext/ReadMe.html
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/lib/ext/ReadMe.html 2006-09-19 12:00:55 UTC (rev 6293)
+++ labs/jbossesb/workspace/rearchitecture/product/lib/ext/ReadMe.html 2006-09-19 12:36:14 UTC (rev 6294)
@@ -1,397 +0,0 @@
-<html>
- <head>
-<!-- Generated from XML source. Copyright 2001 Robert Harder. -->
- <title>Base64 - A Public Domain Base64 Encoder/Decoder for Java</title>
- <meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1"/>
- <meta http-equiv="Content-Language" content="EN"/>
- <meta name="keywords" content="base64, base, 64, java, public domain"/>
- <meta name="description" content="Base64 - A Public Domain Base64 Encoder/Decoder for Java"/>
- <meta name="abstract" content="Base64 - A Public Domain Base64 Encoder/Decoder for Java"/>
- <meta name="author" content="Robert Harder"/>
- <meta name="copyright" content="Robert Harder, 2004"/>
- <meta name="distribution" content="Global"/>
- <meta name="revisit-after" content="7 days"/>
- <meta name="robots" content="FOLLOW,INDEX"/>
- <link rel="ICON" href="./favicon.ico" type="image/x-icon"/>
- <link rel="SHORTCUT ICON" href="./favicon.ico"/>
- <base target="_parent"/>
- <style type="text/css">
-<!--
-
-
-body { margin: 0; }
-.iHarderNet { font-family: arial, geneva, lucida sans unicode, helvetica; color: white; text-align: center; font-size: 14pt; }
-.i_iHarder { font-family: times new roman, courier; font-style: italic; font-weight: bold; font-size: 12pt; }
-
- .MainTitle
- { color: white;
- font-family: arial, geneva, lucida sans unicode, helvetica;
- text-align: center;
- font-weight: bold;
- font-size: 24pt;
- font-style: italic;
- margin-bottom: 4pt;
- }
-
- .OpenTS_Home
- { color: white;
- font-family: arial, geneva, lucida sans unicode, helvetica;
- text-align: center;
- font-weight: bold;
- font-size: 14pt;
- font-style: italic;
- }
-
-
- .Menu
- { margin-top: 10pt;
- margin-left: 6pt;
- text-indent: -6pt;
- font-family: arial, geneva, lucida sans unicode, helvetica;
- font-weight: bold;
- font-size: 10pt;
- }
-
- .SubMenu
- { margin-top: -5pt;
- margin-left: 4pt;
- }
-
-
- .MenuItem
- { margin-top: 10pt;
- font-family: arial, geneva, lucida sans unicode, helvetica;
- font-weight: bold;
- font-size: 10pt;
- }
-
- .Menu A
- { color: #000033;
- }
-
- .Logo
- { text-align: center;
- }
-
-.SubTitle
-{ font-family: Arial, san serif;
- font-size: 16pt;
- font-style: italic;
- font-weight: bold;
-}
-
-
- .SectionTitle
- { margin-top: 1em;
- margin-left: 1em;
- margin-right: 50%;
- font-family: arial, geneva, lucida sans unicode, helvetica;
- font-weight: bold;
- font-size: larger;
- /*border-top: 4px double black;*/
- border-bottom: 4px double black;
- }
-
- .MainSectionTitle
- { margin-top: 1em;
- font-family: arial, geneva, lucida sans unicode, helvetica;
- font-weight: bold;
- font-size: 22pt;
- font-style: italic;
- border-bottom: 4px double black;
- }
-
- .SectionBody
- { margin-top: 1em;
- }
-
- .MainSectionBody
- { margin-top: 10pt;
- }
-
- .MainPage
- { margin: 4pt;
- margin-right: 24pt;
- }
-
- .FAQList_Question
- {
- font-family: arial, geneva, lucida sans unicode, helvetica;
- font-weight: bold;
- }
-
- .FAQ_Question
- {
- font-family: arial, geneva, lucida sans unicode, helvetica;
- font-weight: bold;
- }
-
- .FAQ_Answer
- {
- }
-
-
- .TopMenu
- { margin-top: 20pt;
- margin-bottom: 10pt;
- border-bottom: 4px black;
- text-align: center
- }
-
- .BottomMenu
- { margin-top: 0.1in;
- border-top: 4px double black;
- margin-bottom: 10pt;
- border-bottom: 4px black;
- text-align: center
- }
-
- p
- {
- margin-top: 0.1in;
- text-indent: 1em;
- }
-
- li
- { margin-top: 0.2in;
- }
-
- ul
- { margin-left: 0.25in;
- margin-top: 0.1in;
- }
-
- tt
- { font-size: larger;
- }
-
- a
- { color: #000055;
- }
- a:hover
- { background: lavender;
- text-decoration: none;
- color: black;
- }
-
- p.alert { border-left:solid red 6px; margin-left:-12px; padding-left:6px; }
- pre { padding:1ex; border: solid gray 1px;}
- code { font-size: 95%; }
- dl dt { font-weight: bold }
- dl dd { margin-bottom: 1em }
- .newCode { background: #EEEEEE; }
-
-
- -->
- </style>
- </head>
- <body bgcolor="white">
- <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
- <tr bgcolor="#000066" height="50">
- <td width="128" height="50">
- <div class="iHarderNet">
- <a href="http://www.iHarder.net">
- <span class="iHarderNet"><span class="i_iHarder">i</span>Harder.net</span>
- </a>
- </div>
- </td>
- <td width="*">
- <div class="MainTitle">
- <title-medium>Base64</title-medium>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <div style="margin:0 ; border-top: 1px double black"/>
- </td>
- </tr>
- <tr height="*">
- <td width="128" valign="top" bgcolor="#9090d0">
- <table width="100%" height="100%" cellpadding="2" cellspacing="0" border="0">
- <tr height="1">
- <td height="1" width="120" bgcolor="white" valign="center" align="center">
- <div class="SubTitle">
- Base64
- </div>
- </td>
- </tr>
- <tr>
- <td valign="top" height="*" style="border-top: solid black 1px; border-right: solid black 1px">
- <div class="Menu">
- <a title="" href="./.">Home</a>
- </div>
- <div class="Menu">
- <a title="A Java framework for the Tabu Search meta-heuristic" href="http://OpenTS.iHarder.net">OpenTS</a>
- </div>
- <div class="Menu">
- <a title="Software and tutorials for programming Mac OS X" href="./macosx">Mac OS X</a>
- </div>
- <div class="Menu">
- <a title="Xmlize (like serialize) your Java objects into XML documents." href="./xmlizable">Xmlizable</a>
- </div>
- <div class="Menu">
- <a title="Public Domain Base64 Java utility." href="./base64">Base64</a>
- </div>
- <div class="Menu">
- <a title="Drag and drop files into your Java programs" href="./filedrop">FileDrop</a>
- </div>
- <div class="Menu">
- <a title="View Mr. Harder's online resume" href="http://resume.iharder.net">Mr. Harder's Resume</a>
- </div>
- <div class="Menu">
- <a title="Send email to Mr. Harder" href="mailto:robertharder[nospam]gmail.com">Contact Mr. Harder</a>
- </div>
- <p>
- <hr align="center"/>
- </p>
- <div align="center" style="text-align:center">
- <a href="http://sourceforge.net">
- <img src="http://sourceforge.net/sflogo.php?group_id=23200" width="88" height="31" border="0" alt="SourceForge Logo"/>
- </a>
- </div>
- <p/>
- <div align="center" style="text-align:center">
- <a href="http://iharder.sourceforge.net/gotmoney.php">
- <img src="http://iharder.sourceforge.net/gotmoney.gif" width="88" height="32" border="0" alt="got money?"/>
- </a>
- </div>
- </td>
- </tr>
- </table>
- </td>
- <td width="*" height="*" bgcolor="white" valign="top">
- <div class="MainPage">
-
- <div class="MainSectionTitle">Summary</div><div class="MainSectionBody">
-
-<P><em>Now supports GZip-(de)compressing data before/after encoding!</em></P>
-
- <P>
- This is a <strong>Public Domain</strong> Java class providing
- <strong>very fast</strong> Base64 encoding and decoding in
- the form of convenience methods and input/output streams.
- </P>
-
- <P style="text-align:center; font-weight:bold; font-size:larger">
- <a href="http://prdownloads.sourceforge.net/iharder/Base64-2.1.zip?download">Download v2.1 Now! base64.zip (40k)</a>
- </P>
-
- <p>
- You can have SourceForge automatically notify you when this Base64 code
- is updated (I highly recommend you do this).
- <a href="http://sourceforge.net/project/filemodule_monitor.php?filemodule_id=30229">Click here.</a>
- </p>
-
- <p>
- There are other Base64 utilities on the Internet, some part
- of proprietary packages, some with various open source licenses.
- In any event, I hope with one or more of these Base64 tools, you won't
- have to write your own like I did.
- </p>
-<p>
-Thanks to Brian Burton for providing this <a href="Base64Test.java">Base64Test.java</a> test class for use with <a href="http://www.junit.org">JUnit.org</a>.
-</p>
-
-
- <p>
- <strong>Changes:</strong>
- <ul>
-<li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
- some convenience methods for reading and writing to and from files.</li>
- <li>
- v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
- with other encodings (like EBCDIC).
- </li>
-
- <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
- encoded data was a single byte.</li>
- <li>v2.0 - I got rid of methods that used booleans to set options.
- Now everything is more consolidated and cleaner. The code now detects
- when data that's being decoded is gzip-compressed and will decompress it
- automatically. Generally things are cleaner. You'll probably have to
- change some method calls that you were making to support the new
- options format (<tt>int</tt>s that you "OR" together).</li>
-
- <li>v1.5.1 - Fixed bug when decompressing and decoding to a
- byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
- Added the ability to "suspend" encoding in the Output Stream so
- you can turn on and off the encoding if you need to embed base64
- data in an otherwise "normal" stream (like an XML file).
- <em>This has not been fully tested, so please alert me to bugs.</em></li>
- <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself. This helps when using GZIP streams. Added the ability to <strong>GZip-compress objects</strong> before encoding them.</li>
- <li>v1.4 - Added some helper methods for reading and writing to/from files.</li>
- <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
- <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
- where last buffer being read, if not completely full, was not returned.</li>
- <li>v1.3.4 - Fixed when <em>Improperly padded base64 stream</em> exception
- was incorrectly thrown.</li>
- <li>A bug has been fixed that kept I/O streams from working at all, really.</li>
- <li>A bug has been fixed affecting you if you use the Base64.InputStream
- to encode data.
- </li>
- <li>A bug has been fixed where if you specified an offset when encoding
- an array of bytes, the offset was ignored.
- </li>
- </ul>
- </p>
-
- </div>
-
- <div class="MainSectionTitle">Example</div><div class="MainSectionBody">
- <p>
- The easiest way to convert some data is with the convenience methods:
- </p>
-<code><pre>String result1 = <strong>Base64.encodeObject</strong>( mySerializableObject );
-String result2 = <strong>Base64.encodeBytes</strong>( new byte[]{ 3, 34, 116, 9 } );
-</pre></code>
-
- <p>
- Or you can use the very efficient streams:
- </p>
-<code><pre>OutputStream out = <strong>new Base64.OutputStream</strong>(
- new FileOutputStream( "out.txt" ) );
-// Go on about your outputting...
-// ...
-
-InputStream in = <strong>new Base64.InputStream</strong>(
- new FileInputStream( "in.txt" ) );
-// Go on about your inputting...
-// ...
-</pre></code>
-
-
- <p>
- There are defaults (OutputStream encodes, InputStream decodes),
- but you can easily override that:
- </p>
-<code><pre>OutputStream out = new Base64.OutputStream(
- new FileOutputStream( "out.txt" ), <strong>Base64.DECODE</strong> );
-// Go on about your outputting...
-// ...
-</pre></code>
-
- </div>
-
-
- </div>
- </td>
- </tr>
- <tr>
- <td bgcolor="#9090d0" style="height: 1em; border-right: solid black 1px"> </td>
- <td>
- <div class="BottomMenu">
- <span class="Menu"><a title="" href="./.">Home</a> | </span>
- <span class="Menu"><a title="A Java framework for the Tabu Search meta-heuristic" href="http://OpenTS.iHarder.net">OpenTS</a> | </span>
- <span class="Menu"><a title="Software and tutorials for programming Mac OS X" href="./macosx">Mac OS X</a> | </span>
- <span class="Menu"><a title="Xmlize (like serialize) your Java objects into XML documents." href="./xmlizable">Xmlizable</a> | </span>
- <span class="Menu"><a title="Public Domain Base64 Java utility." href="./base64">Base64</a> | </span>
- <span class="Menu"><a title="Drag and drop files into your Java programs" href="./filedrop">FileDrop</a> | </span>
- <span class="Menu"><a title="View Mr. Harder's online resume" href="http://resume.iharder.net">Mr. Harder's Resume</a> | </span>
- <span class="Menu"><a title="Send email to Mr. Harder" href="mailto:robertharder[nospam]gmail.com">Contact Mr. Harder</a> | </span>
- </div>
- </td>
- </tr>
- </table>
- </body>
-</html>
More information about the jboss-svn-commits
mailing list