예제 #1
0
 public Reader(String src, String dst, ReadIOCallback cb) throws IOException {
   if (cb == null) {
     throw new NullPointerException();
   }
   this.cb = cb;
   this.src = src;
   RemoteFile uri = newRemoteFile(src);
   cmd = new CustomGetFileCmd("file://localhost/" + uri.getPath(), dst, this);
   channel = ChannelManager.getManager().getExistingChannel("id://" + uri.getHost(), null);
 }
예제 #2
0
 public void setLength(long len) throws IOException {
   try {
     RemoteFile uri = new RemoteFile(dst);
     cmd = new CustomPutFileCmd(src, "file://localhost/" + uri.getPath(), len, this);
     channel = ChannelManager.getManager().getExistingChannel("id://" + uri.getHost(), null);
     cmd.executeAsync(channel, this);
     cb.info(String.valueOf(cmd.getId()));
     synchronized (this) {
       if (!suspended) {
         return;
       }
     }
     if (logger.isInfoEnabled()) {
       logger.info(cmd.getId() + " suspended before. Sending signal.");
     }
     cmd.suspend();
   } catch (Exception e) {
     throw new IOException(e.getMessage());
   }
 }