@Override public FSDataOutputStream append(Path cPath, int bufferSize, Progressable progress) throws IOException { LOG.info("append(" + cPath + ", " + bufferSize + ", " + progress + ")"); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath)); long fileId = mTFS.getFileId(path); TachyonFile file = mTFS.getFile(fileId); if (file.length() > 0) { LOG.warn("This maybe an error."); } return new FSDataOutputStream(file.getOutStream(), mStatistics); }
long fileId = mTFS.getFileId(path); if (fileId == -1) { throw new FileNotFoundException("File does not exist: " + file.getPath());
/** * Attempts to open the specified file for reading. * * @param cPath the file name to open * @param bufferSize the size in bytes of the buffer to be used * @return an FSDataInputStream at the indicated path of a file * @throws IOException if the file cannot be opened (e.g., the path is a folder) */ @Override public FSDataInputStream open(Path cPath, int bufferSize) throws IOException { LOG.info("open(" + cPath + ", " + bufferSize + ")"); if (mStatistics != null) { mStatistics.incrementReadOps(1); } TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath)); long fileId = mTFS.getFileId(path); return new FSDataInputStream(new HdfsFileInputStream(mTFS, fileId, Utils.getHDFSPath(path, mUnderFSAddress), getConf(), bufferSize, mStatistics, mTachyonConf)); }