src/java.base/share/classes/java/net/SocketOutputStream.java
changeset 58242 94bb65cb37d3
parent 54689 b28b7f631301
equal deleted inserted replaced
58241:33de7752835c 58242:94bb65cb37d3
    77      * Writes to the socket.
    77      * Writes to the socket.
    78      * @param fd the FileDescriptor
    78      * @param fd the FileDescriptor
    79      * @param b the data to be written
    79      * @param b the data to be written
    80      * @param off the start offset in the data
    80      * @param off the start offset in the data
    81      * @param len the number of bytes that are written
    81      * @param len the number of bytes that are written
    82      * @exception IOException If an I/O error has occurred.
    82      * @throws    IOException If an I/O error has occurred.
    83      */
    83      */
    84     private native void socketWrite0(FileDescriptor fd, byte[] b, int off,
    84     private native void socketWrite0(FileDescriptor fd, byte[] b, int off,
    85                                      int len) throws IOException;
    85                                      int len) throws IOException;
    86 
    86 
    87     /**
    87     /**
    88      * Writes to the socket with appropriate locking of the
    88      * Writes to the socket with appropriate locking of the
    89      * FileDescriptor.
    89      * FileDescriptor.
    90      * @param b the data to be written
    90      * @param b the data to be written
    91      * @param off the start offset in the data
    91      * @param off the start offset in the data
    92      * @param len the number of bytes that are written
    92      * @param len the number of bytes that are written
    93      * @exception IOException If an I/O error has occurred.
    93      * @throws    IOException If an I/O error has occurred.
    94      */
    94      */
    95     private void socketWrite(byte b[], int off, int len) throws IOException {
    95     private void socketWrite(byte b[], int off, int len) throws IOException {
    96 
    96 
    97 
    97 
    98         if (len <= 0 || off < 0 || len > b.length - off) {
    98         if (len <= 0 || off < 0 || len > b.length - off) {
   118     }
   118     }
   119 
   119 
   120     /**
   120     /**
   121      * Writes a byte to the socket.
   121      * Writes a byte to the socket.
   122      * @param b the data to be written
   122      * @param b the data to be written
   123      * @exception IOException If an I/O error has occurred.
   123      * @throws    IOException If an I/O error has occurred.
   124      */
   124      */
   125     public void write(int b) throws IOException {
   125     public void write(int b) throws IOException {
   126         temp[0] = (byte)b;
   126         temp[0] = (byte)b;
   127         socketWrite(temp, 0, 1);
   127         socketWrite(temp, 0, 1);
   128     }
   128     }
   129 
   129 
   130     /**
   130     /**
   131      * Writes the contents of the buffer <i>b</i> to the socket.
   131      * Writes the contents of the buffer <i>b</i> to the socket.
   132      * @param b the data to be written
   132      * @param b the data to be written
   133      * @exception SocketException If an I/O error has occurred.
   133      * @throws    SocketException If an I/O error has occurred.
   134      */
   134      */
   135     public void write(byte b[]) throws IOException {
   135     public void write(byte b[]) throws IOException {
   136         socketWrite(b, 0, b.length);
   136         socketWrite(b, 0, b.length);
   137     }
   137     }
   138 
   138 
   140      * Writes <i>length</i> bytes from buffer <i>b</i> starting at
   140      * Writes <i>length</i> bytes from buffer <i>b</i> starting at
   141      * offset <i>len</i>.
   141      * offset <i>len</i>.
   142      * @param b the data to be written
   142      * @param b the data to be written
   143      * @param off the start offset in the data
   143      * @param off the start offset in the data
   144      * @param len the number of bytes that are written
   144      * @param len the number of bytes that are written
   145      * @exception SocketException If an I/O error has occurred.
   145      * @throws    SocketException If an I/O error has occurred.
   146      */
   146      */
   147     public void write(byte b[], int off, int len) throws IOException {
   147     public void write(byte b[], int off, int len) throws IOException {
   148         socketWrite(b, off, len);
   148         socketWrite(b, off, len);
   149     }
   149     }
   150 
   150