예제 #1
0
 /**
  * ** Writes the specified byte array to the specified socket's output stream ** @param socket The
  * socket which's output stream to write to ** @param b The byte array to write to the socket
  * output stream ** @throws IOException if an error occurs
  */
 protected static void socketWriteBytes(Socket socket, byte b[]) throws IOException {
   if ((socket != null) && (b != null)) {
     OutputStream output = socket.getOutputStream();
     output.write(b);
     output.flush();
   }
 }
예제 #2
0
 /**
  * ** Writes <code>length</code> bytes from the specified byte array ** starting at <code>offset
  * </code> to the specified socket's output stream. ** @param socket The socket which's output
  * stream to write to ** @param b The byte array to write to the socket output stream ** @param
  * offset The start offset in the data to begin writing at ** @param length The length of the
  * data. Normally <code>b.length</code> ** @throws IOException if an error occurs
  */
 protected static void socketWriteBytes(Socket socket, byte b[], int offset, int length)
     throws IOException {
   if ((socket != null) && (b != null)) {
     int bofs = offset;
     int blen = (length >= 0) ? length : b.length;
     OutputStream output = socket.getOutputStream();
     output.write(b, bofs, blen);
     output.flush();
   }
 }