Merge pull request #150 from dkocher/master

Change handle to byte[]. Fix interoperability issue with Tectia SSH Serv...
This commit is contained in:
Shikhar Bhushan
2014-09-18 19:20:13 +05:30
4 changed files with 9 additions and 9 deletions

View File

@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
public class RemoteDirectory public class RemoteDirectory
extends RemoteResource { extends RemoteResource {
public RemoteDirectory(Requester requester, String path, String handle) { public RemoteDirectory(Requester requester, String path, byte[] handle) {
super(requester, path, handle); super(requester, path, handle);
} }

View File

@@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
public class RemoteFile public class RemoteFile
extends RemoteResource { extends RemoteResource {
public RemoteFile(Requester requester, String path, String handle) { public RemoteFile(Requester requester, String path, byte[] handle) {
super(requester, path, handle); super(requester, path, handle);
} }
@@ -108,7 +108,7 @@ public class RemoteFile
return 1 + // packet type return 1 + // packet type
4 + // request id 4 + // request id
4 + // next length 4 + // next length
handle.length() + // next handle.length + // next
8 + // file offset 8 + // file offset
4 + // data length 4 + // data length
4; // packet length 4; // packet length

View File

@@ -30,9 +30,9 @@ public abstract class RemoteResource
protected final Requester requester; protected final Requester requester;
protected final String path; protected final String path;
protected final String handle; protected final byte[] handle;
protected RemoteResource(Requester requester, String path, String handle) { protected RemoteResource(Requester requester, String path, byte[] handle) {
this.requester = requester; this.requester = requester;
this.path = path; this.path = path;
this.handle = handle; this.handle = handle;

View File

@@ -132,9 +132,9 @@ public class SFTPEngine
public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa) public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa)
throws IOException { throws IOException {
final String handle = doRequest( final byte[] handle = doRequest(
newRequest(PacketType.OPEN).putString(path).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa) newRequest(PacketType.OPEN).putString(path).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa)
).ensurePacketTypeIs(PacketType.HANDLE).readString(); ).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
return new RemoteFile(this, path, handle); return new RemoteFile(this, path, handle);
} }
@@ -150,9 +150,9 @@ public class SFTPEngine
public RemoteDirectory openDir(String path) public RemoteDirectory openDir(String path)
throws IOException { throws IOException {
final String handle = doRequest( final byte[] handle = doRequest(
newRequest(PacketType.OPENDIR).putString(path) newRequest(PacketType.OPENDIR).putString(path)
).ensurePacketTypeIs(PacketType.HANDLE).readString(); ).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
return new RemoteDirectory(this, path, handle); return new RemoteDirectory(this, path, handle);
} }