code: private boolean transfer(long total,
                               GlobusInputStream in,
                               GlobusOutputStream out)
          throws IOException {
  
          byte [] buffer       = new byte[bufferSize];
          int bytes            = 0;
          long totalBytes      = total;
          long transferedBytes = 0;
  
          if (total == -1) {
              while( (bytes = in.read(buffer)) != -1) {
                  out.write(buffer, 0, bytes);
                  out.flush();
  
                  if (listeners != null) {
                      transferedBytes += bytes;
                      fireUrlTransferProgressEvent(totalBytes,
                                                   transferedBytes);
                  }
                  if (isCanceled()) return false;
              }
          } else {
              while ( total != 0 ) {
  
                  bytes = bufferSize;
                  if (total < bufferSize) bytes = (int)total;
  
                  bytes = in.read(buffer);
                  out.write(buffer, 0, bytes);
                  out.flush();
                  total -= bytes;
  
                  if (listeners != null) {
                      transferedBytes += bytes;
                      fireUrlTransferProgressEvent(totalBytes,
                                                   transferedBytes);
                  }
                  if (isCanceled()) return false;
              }
          }
  
          return true;
      }
docs: This function performs the actual transfer.