< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BASE64DecoderStream.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

@@ -68,10 +68,11 @@
      * @return     next byte of data, or <code>-1</code> if the end of the
      *             stream is reached.
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
+    @Override
     public int read() throws IOException {
         if (index >= bufsize) {
             decode(); // Fills up buffer
             if (bufsize == 0) // buffer is empty
                 return -1;

@@ -92,10 +93,11 @@
      * @return     the total number of bytes read into the buffer, or
      *             <code>-1</code> if there is no more data because the end of
      *             the stream has been reached.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public int read(byte[] buf, int off, int len) throws IOException {
         int i, c;
         for (i = 0; i < len; i++) {
             if ((c = read()) == -1) {
                 if (i == 0) // At end of stream, so we should

@@ -110,20 +112,22 @@
 
     /**
      * Tests if this input stream supports marks. Currently this class
      * does not support marks
      */
+    @Override
     public boolean markSupported() {
         return false; // Maybe later ..
     }
 
     /**
      * Returns the number of bytes that can be read from this input
      * stream without blocking. However, this figure is only
      * a close approximation in case the original encoded stream
      * contains embedded CRLFs; since the CRLFs are discarded, not decoded
      */
+    @Override
     public int available() throws IOException {
          // This is only an estimate, since in.available()
          // might include CRLFs too ..
          return ((in.available() * 3)/4 + (bufsize-index));
     }

@@ -198,10 +202,14 @@
      * Base64 decode a byte array.  No line breaks are allowed.
      * This method is suitable for short strings, such as those
      * in the IMAP AUTHENTICATE protocol, but not to decode the
      * entire content of a MIME part.
      *
+     * @param inbuf byte array to decode
+     *
+     * @return decoded byte array
+     *
      * NOTE: inbuf may only contain valid base64 characters.
      *       Whitespace is not ignored.
      */
     public static byte[] decode(byte[] inbuf) {
         int size = (inbuf.length / 4) * 3;
< prev index next >