/** * Returns the {@code OutStream} of this file, use the specified write type. Always return a * {@code FileOutStream}. * * @param writeType the OutStream's write type which is unused * * @return the OutStream * @throws IOException when an event that prevents the operation from completing is encountered */ public FileOutStream getOutStream(WriteType writeType) throws IOException { return getOutStream(); }
private void write(TachyonFS tachyonClient) throws IOException { RawTable rawTable = tachyonClient.getRawTable(mTablePath); LOG.debug("Writing data..."); for (int column = 0; column < COLS; column ++) { RawColumn rawColumn = rawTable.getRawColumn(column); if (!rawColumn.createPartition(0)) { throw new IOException("Failed to create partition in table " + mTablePath + " under column " + column); } ByteBuffer buf = ByteBuffer.allocate(mDataLength * 4); buf.order(ByteOrder.nativeOrder()); for (int k = 0; k < mDataLength; k ++) { buf.putInt(k); } buf.flip(); TachyonFile tFile = rawColumn.getPartition(0); FileOutStream os = tFile.getOutStream(mWriteType); os.write(buf.array()); os.close(); } }
@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); }
file.setUFSConf(getConf()); return new FSDataOutputStream(file.getOutStream(), mStatistics);