< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BASE64EncoderStream.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -78,29 +78,32 @@
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         for (int i = 0; i < len; i++)
             write(b[off + i]);
     }
 
     /**
      * Encodes <code>b.length</code> bytes to this output stream.
      * @param      b   the data to be written.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(byte[] b) throws IOException {
         write(b, 0, b.length);
     }
 
     /**
      * Encodes the specified <code>byte</code> to this output stream.
      * @param      c   the <code>byte</code>.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(int c) throws IOException {
         buffer[bufsize++] = (byte)c;
         if (bufsize == 3) { // Encoding unit = 3 bytes
             encode();
             bufsize = 0;

@@ -110,10 +113,11 @@
     /**
      * Flushes this output stream and forces any buffered output bytes
      * to be encoded out to the stream.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void flush() throws IOException {
         if (bufsize > 0) { // If there's unencoded characters in the buffer ..
             encode();      // .. encode them
             bufsize = 0;
         }

@@ -122,10 +126,11 @@
 
     /**
      * Forces any buffered output bytes to be encoded out to the stream
      * and closes this output stream
      */
+    @Override
     public void close() throws IOException {
         flush();
         out.close();
     }
 

@@ -184,10 +189,14 @@
     /**
      * Base64 encode a byte array.  No line breaks are inserted.
      * This method is suitable for short strings, such as those
      * in the IMAP AUTHENTICATE protocol, but not to encode the
      * entire content of a MIME part.
+     *
+     * @param inbuf byte array to encode.
+     *
+     * @return encoded byte array.
      */
     public static byte[] encode(byte[] inbuf) {
         if (inbuf.length == 0)
             return inbuf;
         byte[] outbuf = new byte[((inbuf.length + 2) / 3) * 4];
< prev index next >