try {
long len = 0;
if (fs.exists(fileName)) {
len = fs.length(fileName);
}
RandomAccessOutputStream raos
= fs.getRandomAccessOutputStream(fileName);
raos.seek(len);
// use buffering
out = new OutputStreamWriter(
new BufferedOutputStream(raos, 1024),
ENCODING);
} catch (FileSystemException e) {