this.makePath(filepath, conf);
Path randompath = new Path(this.file + "_" + java.util.UUID.randomUUID().toString());
try {
FSDataOutputStream writer = fs.create(randompath);
Reader reader = stream.getReader();
if (!(reader instanceof BufferedReader)) {
reader = new BufferedReader(reader);
}
BufferedReader br = (BufferedReader) reader;
String s1 = null;
while ((s1 = br.readLine()) != null) {
writer.write(new String(s1.trim().replaceAll("(\r)|(\n)","")+ "\n").getBytes());
}
br.close();
writer.close();
reader.close();
fs.delete(filepath, true);
fs.rename(randompath, filepath);
} catch (Exception e) {
fs.delete(randompath, true);