use of org.apache.hadoop.fs.Options.CreateOpts.BlockSize in project hadoop by apache.
the class FileSystemTestWrapper method createFile.
/*
* Create files with numBlocks blocks each with block size blockSize.
*/
public long createFile(Path path, int numBlocks, CreateOpts... options) throws IOException {
BlockSize blockSizeOpt = CreateOpts.getOpt(CreateOpts.BlockSize.class, options);
long blockSize = blockSizeOpt != null ? blockSizeOpt.getValue() : DEFAULT_BLOCK_SIZE;
FSDataOutputStream out = create(path, EnumSet.of(CreateFlag.CREATE), options);
byte[] data = getFileData(numBlocks, blockSize);
out.write(data, 0, data.length);
out.close();
return data.length;
}
use of org.apache.hadoop.fs.Options.CreateOpts.BlockSize in project hadoop by apache.
the class FileSystemTestWrapper method appendToFile.
public void appendToFile(Path path, int numBlocks, CreateOpts... options) throws IOException {
BlockSize blockSizeOpt = CreateOpts.getOpt(CreateOpts.BlockSize.class, options);
long blockSize = blockSizeOpt != null ? blockSizeOpt.getValue() : DEFAULT_BLOCK_SIZE;
FSDataOutputStream out;
out = fs.append(path);
byte[] data = getFileData(numBlocks, blockSize);
out.write(data, 0, data.length);
out.close();
}
Aggregations