use of apoc.util.StreamConnection in project neo4j-apoc-procedures by neo4j-contrib.
the class S3Aws method getS3AwsInputStream.
public StreamConnection getS3AwsInputStream(S3Params s3Params) {
S3Object s3Object = s3Client.getObject(s3Params.getBucket(), s3Params.getKey());
ObjectMetadata metadata = s3Object.getObjectMetadata();
return new StreamConnection() {
@Override
public InputStream getInputStream() throws IOException {
return s3Object.getObjectContent();
}
@Override
public String getEncoding() {
return metadata.getContentEncoding();
}
@Override
public long getLength() {
return metadata.getContentLength();
}
};
}
use of apoc.util.StreamConnection in project neo4j-apoc-procedures by neo4j-contrib.
the class HDFSUtils method readFile.
public static StreamConnection readFile(String fileName) throws IOException {
FileSystem hdfs = getFileSystem(fileName);
Path file = getPath(fileName);
FileStatus fileStatus = hdfs.getFileStatus(file);
return new StreamConnection() {
@Override
public InputStream getInputStream() throws IOException {
return hdfs.open(file);
}
@Override
public String getEncoding() {
return "";
}
@Override
public long getLength() {
return fileStatus.getLen();
}
};
}
Aggregations