Code example for SocketException

Methods: initCause, setStackTrace

0
   * disk errors. 
   */ 
  private static IOException ioeToSocketException(IOException ioe) {
    if (ioe.getClass().equals(IOException.class)) {
      // "se" could be a new class in stead of SocketException. 
      IOException se = new SocketException("Original Exception : " + ioe);
      se.initCause(ioe);
      /* Change the stacktrace so that original trace is not truncated 
       * when printed.*/  
      se.setStackTrace(ioe.getStackTrace());
      return se;
    } 
    // otherwise just return the same exception. 
    return ioe;
  } 
 
  /** 
   * Sends upto maxChunks chunks of data. 
   *  
   * When blockInPosition is >= 0, assumes 'out' is a  
   * {@link SocketOutputStream} and tries