geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r581202 - in /geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java: javax/mail/QuotaAwareStore.java javax/mail/Service.java org/apache/geronimo/mail/util/Base64.java
Date Tue, 02 Oct 2007 12:05:23 GMT
Author: rickmcguire
Date: Tue Oct  2 05:05:22 2007
New Revision: 581202

URL: http://svn.apache.org/viewvc?rev=581202&view=rev
Log:
Add a couple of method options for encode/decode on BASE64 that will be a little more 
efficient for some of the IMAP Base64 operations.  

Also a couple of javadoc updates to API classes. 


Modified:
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/QuotaAwareStore.java
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/Service.java
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/util/Base64.java

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/QuotaAwareStore.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/QuotaAwareStore.java?rev=581202&r1=581201&r2=581202&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/QuotaAwareStore.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/QuotaAwareStore.java
Tue Oct  2 05:05:22 2007
@@ -25,6 +25,7 @@
  * @version $Rev$ $Date$
  */
 public interface QuotaAwareStore {
+    
     /**
      * Get the quotas for the specified root element.
      *

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/Service.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/Service.java?rev=581202&r1=581201&r2=581202&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/Service.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/Service.java
Tue Oct  2 05:05:22 2007
@@ -287,19 +287,23 @@
     /**
      * Attempt the protocol-specific connection; subclasses should override this to establish
      * a connection in the appropriate manner.
-     *
+     * 
      * This method should return true if the connection was established.
      * It may return false to cause the {@link #connect(String, int, String, String)} method
to
      * reattempt the connection after trying to obtain user and password information from
the user.
      * Alternatively it may throw a AuthenticatedFailedException to abandon the conection
attempt.
-     *
-     * @param host
-     * @param port
-     * @param user
-     * @param password
-     * @return
-     * @throws AuthenticationFailedException if authentication fails
-     * @throws MessagingException for other failures
+     * 
+     * @param host     The target host name of the service.
+     * @param port     The connection port for the service.
+     * @param user     The user name used for the connection.
+     * @param password The password used for the connection.
+     * 
+     * @return true if a connection was established, false if there was authentication 
+     *         error with the connection.
+     * @throws AuthenticationFailedException
+     *                if authentication fails
+     * @throws MessagingException
+     *                for other failures
      */
     protected boolean protocolConnect(String host, int port, String user, String password)
throws MessagingException {
         return false;

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/util/Base64.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/util/Base64.java?rev=581202&r1=581201&r2=581202&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/util/Base64.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/util/Base64.java
Tue Oct  2 05:05:22 2007
@@ -35,6 +35,24 @@
     public static byte[] encode(
         byte[]    data)
     {
+        // just forward to the general array encoder. 
+        return encode(data, 0, data.length); 
+    }
+
+    /**
+     * encode the input data producing a base 64 encoded byte array.
+     * 
+     * @param data   The data array to encode.
+     * @param offset The starting offset within the data array.
+     * @param length The length of the data to encode.
+     * 
+     * @return a byte array containing the base 64 encoded data.
+     */
+    public static byte[] encode(
+        byte[]    data,
+        int       offset, 
+        int       length)
+    {
         ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
 
         try
@@ -85,11 +103,30 @@
     public static byte[] decode(
         byte[]    data)
     {
+        // just decode the entire array of data. 
+        return decode(data, 0, data.length); 
+    }
+    
+
+    /**
+     * decode the base 64 encoded input data. It is assumed the input data is valid.
+     * 
+     * @param data   The data array to decode.
+     * @param offset The offset of the data array.
+     * @param length The length of data to decode.
+     * 
+     * @return a byte array representing the decoded data.
+     */
+    public static byte[] decode(
+        byte[]    data, 
+        int       offset, 
+        int       length)
+    {
         ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
 
         try
         {
-            encoder.decode(data, 0, data.length, bOut);
+            encoder.decode(data, offset, length, bOut);
         }
         catch (IOException e)
         {



Mime
View raw message