public class HdfsFileWriter extends Object implements FileWriterI
| Constructor and Description |
|---|
HdfsFileWriter(String hdfsHost) |
HdfsFileWriter(String hdfsHost,
String asUser) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
OutputStream |
getStreamOutputForPath(String fullDestFilePath)
Note that it overwrites the destination file, if present
|
void |
writeBytesAtPath(String fullDestFilePath,
byte[] data) |
void |
writeBytesAtPathIfNotExist(String fullDestFilePath,
byte[] data) |
void |
writeFile(File fileToWrite,
String fullDestFilePath)
Note that it overwrites the destination file, if present
|
public HdfsFileWriter(String hdfsHost) throws IOException, URISyntaxException
hdfsHost - is the namenode host of the hdfs. e.g: hdfs://node1.madgik.di.uoa.gr:50050IOExceptionURISyntaxExceptionpublic HdfsFileWriter(String hdfsHost, String asUser) throws IOException, URISyntaxException
hdfsHost - is the namenode host of the hdfs. e.g: hdfs://node1.madgik.di.uoa.gr:50050asUser - is the username for the hadoop. e.g: sys-hcvIOExceptionURISyntaxExceptionpublic void writeFile(File fileToWrite, String fullDestFilePath) throws IOException
writeFile in interface FileWriterIfullDestFilePath - the full file path to write on hdfs. It should start with a / , as in unix. i.e. /Myfolder/file1.pngIOExceptionpublic OutputStream getStreamOutputForPath(String fullDestFilePath) throws IOException
getStreamOutputForPath in interface FileWriterIfullDestFilePath - gets an output stream for writing on the specified fullDestFilePathIOExceptionpublic void writeBytesAtPath(String fullDestFilePath, byte[] data) throws IOException
writeBytesAtPath in interface FileWriterIIOExceptionpublic void writeBytesAtPathIfNotExist(String fullDestFilePath, byte[] data) throws IOException
writeBytesAtPathIfNotExist in interface FileWriterIIOExceptionpublic void close()
close in interface FileWriterICopyright © 2018. All Rights Reserved.