use of net.yacy.grid.io.assets.FTPStorageFactory in project yacy_grid_mcp by yacy.
the class MultiProtocolURL method get.
public byte[] get(final ClientIdentification.Agent agent, final String username, final String pass) throws IOException {
if (isFile())
return read(new FileInputStream(getFSFile()));
if (isSMB())
return read(new SmbFileInputStream(getSmbFile()));
if (isFTP()) {
FTPStorageFactory client = new FTPStorageFactory(this.host, this.port < 0 ? 21 : this.port, username, pass, false);
Asset<byte[]> asset = client.getStorage().load(this.path);
return asset.getPayload();
}
if (isHTTP() || isHTTPS()) {
// TODO: add agent, user and pass
return ClientConnection.load(this.toString());
}
return null;
}
use of net.yacy.grid.io.assets.FTPStorageFactory in project yacy_grid_mcp by yacy.
the class MultiProtocolURL method getInputStream.
public InputStream getInputStream(final ClientIdentification.Agent agent, final String username, final String pass) throws IOException {
if (isFile())
return new BufferedInputStream(new FileInputStream(getFSFile()));
if (isSMB())
return new BufferedInputStream(new SmbFileInputStream(getSmbFile()));
if (isFTP()) {
FTPStorageFactory client = new FTPStorageFactory(this.host, this.port < 0 ? 21 : this.port, username, pass, false);
Asset<byte[]> asset = client.getStorage().load(this.path);
return new ByteArrayInputStream(asset.getPayload());
}
if (isHTTP() || isHTTPS()) {
// TODO: add agent, user and pass
return new ByteArrayInputStream(ClientConnection.load(this.toString()));
}
return null;
}
Aggregations