jdk/src/share/classes/javax/crypto/CipherInputStream.java
changeset 25176 3c2ba9344cbf
parent 18808 b2eaaaaed037
equal deleted inserted replaced
25175:a97b521192b6 25176:3c2ba9344cbf
   168      * <p>
   168      * <p>
   169      *
   169      *
   170      * @return  the next byte of data, or <code>-1</code> if the end of the
   170      * @return  the next byte of data, or <code>-1</code> if the end of the
   171      *          stream is reached.
   171      *          stream is reached.
   172      * @exception  IOException  if an I/O error occurs.
   172      * @exception  IOException  if an I/O error occurs.
   173      * @since JCE1.2
       
   174      */
   173      */
   175     public int read() throws IOException {
   174     public int read() throws IOException {
   176         if (ostart >= ofinish) {
   175         if (ostart >= ofinish) {
   177             // we loop for new data as the spec says we are blocking
   176             // we loop for new data as the spec says we are blocking
   178             int i = 0;
   177             int i = 0;
   194      * @return     the total number of bytes read into the buffer, or
   193      * @return     the total number of bytes read into the buffer, or
   195      *             <code>-1</code> is there is no more data because the end of
   194      *             <code>-1</code> is there is no more data because the end of
   196      *             the stream has been reached.
   195      *             the stream has been reached.
   197      * @exception  IOException  if an I/O error occurs.
   196      * @exception  IOException  if an I/O error occurs.
   198      * @see        java.io.InputStream#read(byte[], int, int)
   197      * @see        java.io.InputStream#read(byte[], int, int)
   199      * @since      JCE1.2
       
   200      */
   198      */
   201     public int read(byte b[]) throws IOException {
   199     public int read(byte b[]) throws IOException {
   202         return read(b, 0, b.length);
   200         return read(b, 0, b.length);
   203     }
   201     }
   204 
   202 
   215      * @return     the total number of bytes read into the buffer, or
   213      * @return     the total number of bytes read into the buffer, or
   216      *             <code>-1</code> if there is no more data because the end of
   214      *             <code>-1</code> if there is no more data because the end of
   217      *             the stream has been reached.
   215      *             the stream has been reached.
   218      * @exception  IOException  if an I/O error occurs.
   216      * @exception  IOException  if an I/O error occurs.
   219      * @see        java.io.InputStream#read()
   217      * @see        java.io.InputStream#read()
   220      * @since      JCE1.2
       
   221      */
   218      */
   222     public int read(byte b[], int off, int len) throws IOException {
   219     public int read(byte b[], int off, int len) throws IOException {
   223         if (ostart >= ofinish) {
   220         if (ostart >= ofinish) {
   224             // we loop for new data as the spec says we are blocking
   221             // we loop for new data as the spec says we are blocking
   225             int i = 0;
   222             int i = 0;
   252      * <p>The actual number of bytes skipped is returned.
   249      * <p>The actual number of bytes skipped is returned.
   253      *
   250      *
   254      * @param      n the number of bytes to be skipped.
   251      * @param      n the number of bytes to be skipped.
   255      * @return     the actual number of bytes skipped.
   252      * @return     the actual number of bytes skipped.
   256      * @exception  IOException  if an I/O error occurs.
   253      * @exception  IOException  if an I/O error occurs.
   257      * @since JCE1.2
       
   258      */
   254      */
   259     public long skip(long n) throws IOException {
   255     public long skip(long n) throws IOException {
   260         int available = ofinish - ostart;
   256         int available = ofinish - ostart;
   261         if (n > available) {
   257         if (n > available) {
   262             n = available;
   258             n = available;
   275      * <B>should</B> be overridden by subclasses.
   271      * <B>should</B> be overridden by subclasses.
   276      *
   272      *
   277      * @return     the number of bytes that can be read from this input stream
   273      * @return     the number of bytes that can be read from this input stream
   278      *             without blocking.
   274      *             without blocking.
   279      * @exception  IOException  if an I/O error occurs.
   275      * @exception  IOException  if an I/O error occurs.
   280      * @since      JCE1.2
       
   281      */
   276      */
   282     public int available() throws IOException {
   277     public int available() throws IOException {
   283         return (ofinish - ostart);
   278         return (ofinish - ostart);
   284     }
   279     }
   285 
   280 
   290      * The <code>close</code> method of <code>CipherInputStream</code>
   285      * The <code>close</code> method of <code>CipherInputStream</code>
   291      * calls the <code>close</code> method of its underlying input
   286      * calls the <code>close</code> method of its underlying input
   292      * stream.
   287      * stream.
   293      *
   288      *
   294      * @exception  IOException  if an I/O error occurs.
   289      * @exception  IOException  if an I/O error occurs.
   295      * @since JCE1.2
       
   296      */
   290      */
   297     public void close() throws IOException {
   291     public void close() throws IOException {
   298         if (closed) {
   292         if (closed) {
   299             return;
   293             return;
   300         }
   294         }
   319      *
   313      *
   320      * @return  <code>false</code>, since this class does not support the
   314      * @return  <code>false</code>, since this class does not support the
   321      *          <code>mark</code> and <code>reset</code> methods.
   315      *          <code>mark</code> and <code>reset</code> methods.
   322      * @see     java.io.InputStream#mark(int)
   316      * @see     java.io.InputStream#mark(int)
   323      * @see     java.io.InputStream#reset()
   317      * @see     java.io.InputStream#reset()
   324      * @since   JCE1.2
       
   325      */
   318      */
   326     public boolean markSupported() {
   319     public boolean markSupported() {
   327         return false;
   320         return false;
   328     }
   321     }
   329 }
   322 }