public SFTPEngine init() throws IOException { transmit(new SFTPPacket<Request>(PacketType.INIT).putUInt32(MAX_SUPPORTED_VERSION)); final SFTPPacket<Response> response = reader.readPacket(); final PacketType type = response.readType(); if (type != PacketType.VERSION) throw new SFTPException("Expected INIT packet, received: " + type); operativeVersion = response.readUInt32AsInt(); log.debug("Server version {}", operativeVersion); if (MAX_SUPPORTED_VERSION < operativeVersion) throw new SFTPException("Server reported incompatible protocol version: " + operativeVersion); while (response.available() > 0) serverExtensions.put(response.readString(), response.readString()); // Start reader thread reader.start(); return this; }
public FileAttributes readFileAttributes() throws SFTPException { final FileAttributes.Builder builder = new FileAttributes.Builder(); try { final int mask = readUInt32AsInt(); if (FileAttributes.Flag.SIZE.isSet(mask)) builder.withSize(readUInt64()); if (FileAttributes.Flag.UIDGID.isSet(mask)) builder.withUIDGID(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.MODE.isSet(mask)) builder.withPermissions(readUInt32AsInt()); if (FileAttributes.Flag.ACMODTIME.isSet(mask)) builder.withAtimeMtime(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.EXTENDED.isSet(mask)) { final int extCount = readUInt32AsInt(); for (int i = 0; i < extCount; i++) builder.withExtended(readString(), readString()); } } catch (BufferException be) { throw new SFTPException(be); } return builder.build(); }
public SFTPEngine init() throws IOException { transmit(new SFTPPacket<Request>(PacketType.INIT).putUInt32(MAX_SUPPORTED_VERSION)); final SFTPPacket<Response> response = reader.readPacket(); final PacketType type = response.readType(); if (type != PacketType.VERSION) throw new SFTPException("Expected INIT packet, received: " + type); operativeVersion = response.readUInt32AsInt(); log.debug("Server version {}", operativeVersion); if (MAX_SUPPORTED_VERSION < operativeVersion) throw new SFTPException("Server reported incompatible protocol version: " + operativeVersion); while (response.available() > 0) serverExtensions.put(response.readString(), response.readString()); // Start reader thread reader.start(); return this; }
public SFTPEngine init() throws IOException { transmit(new SFTPPacket<Request>(PacketType.INIT).putUInt32(MAX_SUPPORTED_VERSION)); final SFTPPacket<Response> response = reader.readPacket(); final PacketType type = response.readType(); if (type != PacketType.VERSION) throw new SFTPException("Expected INIT packet, received: " + type); operativeVersion = response.readUInt32AsInt(); log.debug("Server version {}", operativeVersion); if (MAX_SUPPORTED_VERSION < operativeVersion) throw new SFTPException("Server reported incompatible protocol version: " + operativeVersion); while (response.available() > 0) serverExtensions.put(response.readString(), response.readString()); // Start reader thread reader.start(); return this; }
public FileAttributes readFileAttributes() throws SFTPException { final FileAttributes.Builder builder = new FileAttributes.Builder(); try { final int mask = readUInt32AsInt(); if (FileAttributes.Flag.SIZE.isSet(mask)) builder.withSize(readUInt64()); if (FileAttributes.Flag.UIDGID.isSet(mask)) builder.withUIDGID(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.MODE.isSet(mask)) builder.withPermissions(readUInt32AsInt()); if (FileAttributes.Flag.ACMODTIME.isSet(mask)) builder.withAtimeMtime(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.EXTENDED.isSet(mask)) { final int extCount = readUInt32AsInt(); for (int i = 0; i < extCount; i++) builder.withExtended(readString(), readString()); } } catch (BufferException be) { throw new SFTPException(be); } return builder.build(); }
public FileAttributes readFileAttributes() throws SFTPException { final FileAttributes.Builder builder = new FileAttributes.Builder(); try { final int mask = readUInt32AsInt(); if (FileAttributes.Flag.SIZE.isSet(mask)) builder.withSize(readUInt64()); if (FileAttributes.Flag.UIDGID.isSet(mask)) builder.withUIDGID(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.MODE.isSet(mask)) builder.withPermissions(readUInt32AsInt()); if (FileAttributes.Flag.ACMODTIME.isSet(mask)) builder.withAtimeMtime(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.EXTENDED.isSet(mask)) { final int extCount = readUInt32AsInt(); for (int i = 0; i < extCount; i++) builder.withExtended(readString(), readString()); } } catch (BufferException be) { throw new SFTPException(be); } return builder.build(); }