Java Code Examples for com.jcraft.jsch.ChannelSftp#OVERWRITE

The following examples show how to use com.jcraft.jsch.ChannelSftp#OVERWRITE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SftpClient.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * @param localFilePath
 * @param remoteFile
 * @throws HopWorkflowException
 * @deprecated use {@link #get(FileObject, String)}
 */
@Deprecated
public void get( String localFilePath, String remoteFile ) throws HopWorkflowException {
  int mode = ChannelSftp.OVERWRITE;
  try {
    c.get( remoteFile, localFilePath, null, mode );
  } catch ( SftpException e ) {
    throw new HopWorkflowException( e );
  }
}
 
Example 2
Source File: SFtpUThreadTaskAdapter.java    From Aria with Apache License 2.0 5 votes vote down vote up
/**
 * 恢复上传
 *
 * @throws SftpException
 * @throws IOException
 */
private void upload(String remotePath) throws SftpException, IOException {
  UploadEntity entity = (UploadEntity) getTaskWrapper().getEntity();
  remotePath = remotePath.concat("/").concat(entity.getFileName());
  BufferedRandomAccessFile brf = new BufferedRandomAccessFile(getThreadConfig().tempFile, "r");
  int mode = ChannelSftp.OVERWRITE;
  boolean isResume = false;
  if (getThreadRecord().startLocation > 0) {
    brf.seek(getThreadRecord().startLocation);
    mode = ChannelSftp.APPEND;
    isResume = true;
  }
  OutputStream os = channelSftp.put(remotePath, new Monitor(isResume), mode);
  byte[] buffer = new byte[4096];
  int bytesRead;
  while ((bytesRead = brf.read(buffer)) != -1) {
    if (getThreadTask().isBreak()) {
      break;
    }
    os.write(buffer, 0, bytesRead);
    if (mSpeedBandUtil != null) {
      mSpeedBandUtil.limitNextBytes(bytesRead);
    }
  }
  os.flush();
  os.close();
  brf.close();
}
 
Example 3
Source File: SFTPClient.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link #get(FileObject, String)}
 * @param localFilePath
 * @param remoteFile
 * @throws KettleJobException
 */
@Deprecated
public void get( String localFilePath, String remoteFile ) throws KettleJobException {
  int mode = ChannelSftp.OVERWRITE;
  try {
    c.get( remoteFile, localFilePath, null, mode );
  } catch ( SftpException e ) {
    throw new KettleJobException( e );
  }
}
 
Example 4
Source File: SFTPConnection.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * SFTP constructor.
 * @param url
 * @param proxy
 */
protected SFTPConnection(URL url, Proxy proxy) {
	super(url, new SFTPAuthority(url, proxy));
	mode = ChannelSftp.OVERWRITE;
}