Package org.vngx.jsch.exception

Examples of org.vngx.jsch.exception.SftpException


    }

    sendOPENDIR(Util.str2byte(dir, _fileEncoding));
    readResponse();
    if( _header.type != SSH_FXP_HANDLE ) {
      throw new SftpException(SSH_FX_FAILURE, "Invalid FXP response: "+_header.type);
    }

    List<String> matches = new ArrayList<String>();
    byte[] bPattern = Util.str2byte(sPattern, UTF8);
    byte[] handle = _buffer.getString();         // filename
    while( true ) {
      sendREADDIR(handle);
      readHeader();
      if( _header.type == SSH_FXP_STATUS ) {
        fill(_buffer, _header.length);
        break;
      } else if( _header.type != SSH_FXP_NAME ) {
        throw new SftpException(SSH_FX_FAILURE, "Invalid FXP response: "+_header.type);
      }

      _buffer.rewind();
      fill(_buffer.buffer, 0, 4);
      _header.length -= 4;
View Full Code Here


  }

  private void throwStatusError(Buffer buf, int status) throws SftpException {
    if( _serverVersion >= 3 &&      // WindRiver's sftp will send invalid
        buf.getLength() >= 4 ) {  // SSH_FXP_STATUS packet.
      throw new SftpException(status, "SFTP status error: " + Util.byte2str(buf.getString(), UTF8));
    } else {
      throw new SftpException(status, "SFTP status error: unknown");
    }
  }
View Full Code Here

  private int readResponseOk() throws IOException, SftpException {
    readHeader();        // Read header data from input
    fill(_buffer, _header.length)// Read rest of data from input stream into buffer
    if( _header.type != SSH_FXP_STATUS ) {
      throw new SftpException(SSH_FX_FAILURE, "Invalid FXP status response: "+_header.type);
    }
    int status = _buffer.getInt();
    if( status != SSH_FX_OK ) {
      throwStatusError(_buffer, status);
    }
View Full Code Here

   * @return the returned string is unquoted
   */
  private String isUnique(String path) throws SftpException, Exception {
    List<String> matches = globRemote(path);
    if( matches.size() != 1 ) {
      throw new SftpException(SSH_FX_FAILURE, path + " is not unique: " + matches);
    }
    return matches.get(0);
  }
View Full Code Here

   * @throws SftpException if not connected or server doesn't support
   *      different encodings
   */
  public void setFilenameEncoding(String encoding) throws SftpException {
    if( getServerVersion() > 3 && !UTF8.equals(encoding) ) {
      throw new SftpException(SSH_FX_FAILURE, "The encoding cannot be changed for this sftp server version");
    }
    _fileEncoding = encoding;
    _utf8 = UTF8.equals(_fileEncoding);
  }
View Full Code Here

    try {
      return Util.byte2str(_realpath(remoteAbsolutePath(path)), _fileEncoding);
    } catch(SftpException e) {
      throw e;
    } catch(Exception e) {
      throw new SftpException(SSH_FX_FAILURE, "Failed to realpath path: "+path, e);
    }
  }
View Full Code Here

          _len -= sent;
          if( (_seq - 1) == __startId || _io_in.available() >= 1024 ) {
            while( _io_in.available() > 0 ) {
              ackId = readResponseOk();
              if( __startId > ackId || ackId > _seq - 1 ) {
                throw new SftpException(SSH_FX_FAILURE, "Invalid ack ID: "+ackId);
              }
              __ackCount++;
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.vngx.jsch.exception.SftpException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.