jdk/src/share/classes/sun/security/ssl/ByteBufferInputStream.java
changeset 14664 e71aa0962e70
parent 5506 202f599c92aa
child 23010 6dadb192ad81
equal deleted inserted replaced
14663:49b7de969579 14664:e71aa0962e70
    48     /**
    48     /**
    49      * Returns a byte from the ByteBuffer.
    49      * Returns a byte from the ByteBuffer.
    50      *
    50      *
    51      * Increments position().
    51      * Increments position().
    52      */
    52      */
       
    53     @Override
    53     public int read() throws IOException {
    54     public int read() throws IOException {
    54 
    55 
    55         if (bb == null) {
    56         if (bb == null) {
    56             throw new IOException("read on a closed InputStream");
    57             throw new IOException("read on a closed InputStream");
    57         }
    58         }
    65     /**
    66     /**
    66      * Returns a byte array from the ByteBuffer.
    67      * Returns a byte array from the ByteBuffer.
    67      *
    68      *
    68      * Increments position().
    69      * Increments position().
    69      */
    70      */
       
    71     @Override
    70     public int read(byte b[]) throws IOException {
    72     public int read(byte b[]) throws IOException {
    71 
    73 
    72         if (bb == null) {
    74         if (bb == null) {
    73             throw new IOException("read on a closed InputStream");
    75             throw new IOException("read on a closed InputStream");
    74         }
    76         }
    79     /**
    81     /**
    80      * Returns a byte array from the ByteBuffer.
    82      * Returns a byte array from the ByteBuffer.
    81      *
    83      *
    82      * Increments position().
    84      * Increments position().
    83      */
    85      */
       
    86     @Override
    84     public int read(byte b[], int off, int len) throws IOException {
    87     public int read(byte b[], int off, int len) throws IOException {
    85 
    88 
    86         if (bb == null) {
    89         if (bb == null) {
    87             throw new IOException("read on a closed InputStream");
    90             throw new IOException("read on a closed InputStream");
    88         }
    91         }
   106 
   109 
   107     /**
   110     /**
   108      * Skips over and discards <code>n</code> bytes of data from this input
   111      * Skips over and discards <code>n</code> bytes of data from this input
   109      * stream.
   112      * stream.
   110      */
   113      */
       
   114     @Override
   111     public long skip(long n) throws IOException {
   115     public long skip(long n) throws IOException {
   112 
   116 
   113         if (bb == null) {
   117         if (bb == null) {
   114             throw new IOException("skip on a closed InputStream");
   118             throw new IOException("skip on a closed InputStream");
   115         }
   119         }
   133     /**
   137     /**
   134      * Returns the number of bytes that can be read (or skipped over)
   138      * Returns the number of bytes that can be read (or skipped over)
   135      * from this input stream without blocking by the next caller of a
   139      * from this input stream without blocking by the next caller of a
   136      * method for this input stream.
   140      * method for this input stream.
   137      */
   141      */
       
   142     @Override
   138     public int available() throws IOException {
   143     public int available() throws IOException {
   139 
   144 
   140         if (bb == null) {
   145         if (bb == null) {
   141             throw new IOException("available on a closed InputStream");
   146             throw new IOException("available on a closed InputStream");
   142         }
   147         }
   148      * Closes this input stream and releases any system resources associated
   153      * Closes this input stream and releases any system resources associated
   149      * with the stream.
   154      * with the stream.
   150      *
   155      *
   151      * @exception  IOException  if an I/O error occurs.
   156      * @exception  IOException  if an I/O error occurs.
   152      */
   157      */
       
   158     @Override
   153     public void close() throws IOException {
   159     public void close() throws IOException {
   154         bb = null;
   160         bb = null;
   155     }
   161     }
   156 
   162 
   157     /**
   163     /**
   158      * Marks the current position in this input stream.
   164      * Marks the current position in this input stream.
   159      */
   165      */
       
   166     @Override
   160     public synchronized void mark(int readlimit) {}
   167     public synchronized void mark(int readlimit) {}
   161 
   168 
   162     /**
   169     /**
   163      * Repositions this stream to the position at the time the
   170      * Repositions this stream to the position at the time the
   164      * <code>mark</code> method was last called on this input stream.
   171      * <code>mark</code> method was last called on this input stream.
   165      */
   172      */
       
   173     @Override
   166     public synchronized void reset() throws IOException {
   174     public synchronized void reset() throws IOException {
   167         throw new IOException("mark/reset not supported");
   175         throw new IOException("mark/reset not supported");
   168     }
   176     }
   169 
   177 
   170     /**
   178     /**
   171      * Tests if this input stream supports the <code>mark</code> and
   179      * Tests if this input stream supports the <code>mark</code> and
   172      * <code>reset</code> methods.
   180      * <code>reset</code> methods.
   173      */
   181      */
       
   182     @Override
   174     public boolean markSupported() {
   183     public boolean markSupported() {
   175         return false;
   184         return false;
   176     }
   185     }
   177 }
   186 }