< prev index next >

src/java.base/share/classes/javax/crypto/CipherOutputStream.java

Print this page




 129         if (obuffer != null) {
 130             output.write(obuffer);
 131             obuffer = null;
 132         }
 133     };
 134 
 135     /**
 136      * Writes <code>b.length</code> bytes from the specified byte array
 137      * to this output stream.
 138      * <p>
 139      * The <code>write</code> method of
 140      * <code>CipherOutputStream</code> calls the <code>write</code>
 141      * method of three arguments with the three arguments
 142      * <code>b</code>, <code>0</code>, and <code>b.length</code>.
 143      *
 144      * @param      b   the data.
 145      * @exception  NullPointerException if <code>b</code> is null.
 146      * @exception  IOException  if an I/O error occurs.
 147      * @see        javax.crypto.CipherOutputStream#write(byte[], int, int)
 148      */
 149     public void write(byte b[]) throws IOException {
 150         write(b, 0, b.length);
 151     }
 152 
 153     /**
 154      * Writes <code>len</code> bytes from the specified byte array
 155      * starting at offset <code>off</code> to this output stream.
 156      *
 157      * @param      b     the data.
 158      * @param      off   the start offset in the data.
 159      * @param      len   the number of bytes to write.
 160      * @exception  IOException  if an I/O error occurs.
 161      */
 162     public void write(byte b[], int off, int len) throws IOException {
 163         obuffer = cipher.update(b, off, len);
 164         if (obuffer != null) {
 165             output.write(obuffer);
 166             obuffer = null;
 167         }
 168     }
 169 
 170     /**
 171      * Flushes this output stream by forcing any buffered output bytes
 172      * that have already been processed by the encapsulated cipher object
 173      * to be written out.
 174      *
 175      * <p>Any bytes buffered by the encapsulated cipher
 176      * and waiting to be processed by it will not be written out. For example,
 177      * if the encapsulated cipher is a block cipher, and the total number of
 178      * bytes written using one of the <code>write</code> methods is less than
 179      * the cipher's block size, no bytes will be written out.
 180      *
 181      * @exception  IOException  if an I/O error occurs.
 182      */




 129         if (obuffer != null) {
 130             output.write(obuffer);
 131             obuffer = null;
 132         }
 133     };
 134 
 135     /**
 136      * Writes <code>b.length</code> bytes from the specified byte array
 137      * to this output stream.
 138      * <p>
 139      * The <code>write</code> method of
 140      * <code>CipherOutputStream</code> calls the <code>write</code>
 141      * method of three arguments with the three arguments
 142      * <code>b</code>, <code>0</code>, and <code>b.length</code>.
 143      *
 144      * @param      b   the data.
 145      * @exception  NullPointerException if <code>b</code> is null.
 146      * @exception  IOException  if an I/O error occurs.
 147      * @see        javax.crypto.CipherOutputStream#write(byte[], int, int)
 148      */
 149     public void write(byte[] b) throws IOException {
 150         write(b, 0, b.length);
 151     }
 152 
 153     /**
 154      * Writes <code>len</code> bytes from the specified byte array
 155      * starting at offset <code>off</code> to this output stream.
 156      *
 157      * @param      b     the data.
 158      * @param      off   the start offset in the data.
 159      * @param      len   the number of bytes to write.
 160      * @exception  IOException  if an I/O error occurs.
 161      */
 162     public void write(byte[] b, int off, int len) throws IOException {
 163         obuffer = cipher.update(b, off, len);
 164         if (obuffer != null) {
 165             output.write(obuffer);
 166             obuffer = null;
 167         }
 168     }
 169 
 170     /**
 171      * Flushes this output stream by forcing any buffered output bytes
 172      * that have already been processed by the encapsulated cipher object
 173      * to be written out.
 174      *
 175      * <p>Any bytes buffered by the encapsulated cipher
 176      * and waiting to be processed by it will not be written out. For example,
 177      * if the encapsulated cipher is a block cipher, and the total number of
 178      * bytes written using one of the <code>write</code> methods is less than
 179      * the cipher's block size, no bytes will be written out.
 180      *
 181      * @exception  IOException  if an I/O error occurs.
 182      */


< prev index next >