metaIndex = new MetaIndex(fin);
private BlockAppender prepareMetaBlock(String name, Algorithm compressAlgo) throws IOException, MetaBlockAlreadyExists { if (blkInProgress == true) { throw new IllegalStateException( "Cannot create Meta Block until previous block is closed."); } if (metaIndex.getMetaByName(name) != null) { throw new MetaBlockAlreadyExists("name=" + name); } MetaBlockRegister mbr = new MetaBlockRegister(name, compressAlgo); WBlockState wbs = new WBlockState(compressAlgo, out, fsOutputBuffer, conf); BlockAppender ba = new BlockAppender(mbr, wbs); blkInProgress = true; metaBlkSeen = true; return ba; }
metaIndex.write(out);
metaIndex.write(out);
metaIndex.write(out);
metaIndex.write(out);
metaIndex = new MetaIndex(fin);
metaIndex = new MetaIndex(fin);
metaIndex.write(out);
metaIndex.write(out);
metaIndex = new MetaIndex(fin);
metaIndex = new MetaIndex(fin);
metaIndex = new MetaIndex(fin);
/** * Constructor * * @param fout * FS output stream. * @param compressionName * Name of the compression algorithm, which will be used for all * data blocks. * @throws IOException * @see Compression#getSupportedAlgorithms */ public Writer(FSDataOutputStream fout, String compressionName, Configuration conf) throws IOException { if (fout.getPos() != 0) { throw new IOException("Output file not at zero offset."); } this.out = fout; this.conf = conf; dataIndex = new DataIndex(compressionName); metaIndex = new MetaIndex(); fsOutputBuffer = new BytesWritable(); Magic.write(fout); }
/** * Constructor * * @param fout * FS output stream. * @param compressionName * Name of the compression algorithm, which will be used for all * data blocks. * @throws IOException * @see Compression#getSupportedAlgorithms */ public Writer(FSDataOutputStream fout, String compressionName, Configuration conf) throws IOException { if (fout.getPos() != 0) { throw new IOException("Output file not at zero offset."); } this.out = fout; this.conf = conf; dataIndex = new DataIndex(compressionName); metaIndex = new MetaIndex(); fsOutputBuffer = new BytesWritable(); Magic.write(fout); }
/** * Constructor * * @param fout * FS output stream. * @param compressionName * Name of the compression algorithm, which will be used for all * data blocks. * @throws IOException * @see Compression#getSupportedAlgorithms */ public Writer(FSDataOutputStream fout, String compressionName, Configuration conf) throws IOException { if (fout.getPos() != 0) { throw new IOException("Output file not at zero offset."); } this.out = fout; this.conf = conf; dataIndex = new DataIndex(compressionName); metaIndex = new MetaIndex(); fsOutputBuffer = new BytesWritable(); Magic.write(fout); }
/** * Constructor * * @param fout * FS output stream. * @param compressionName * Name of the compression algorithm, which will be used for all * data blocks. * @throws IOException * @see Compression#getSupportedAlgorithms */ public Writer(FSDataOutputStream fout, String compressionName, Configuration conf) throws IOException { if (fout.getPos() != 0) { throw new IOException("Output file not at zero offset."); } this.out = fout; this.conf = conf; dataIndex = new DataIndex(compressionName); metaIndex = new MetaIndex(); fsOutputBuffer = new BytesWritable(); Magic.write(fout); }
/** * Stream access to a Meta Block. * * @param name * meta block name * @return BlockReader input stream for reading the meta block. * @throws IOException * @throws MetaBlockDoesNotExist * The Meta Block with the given name does not exist. */ public BlockReader getMetaBlock(String name) throws IOException, MetaBlockDoesNotExist { MetaIndexEntry imeBCIndex = metaIndex.getMetaByName(name); if (imeBCIndex == null) { throw new MetaBlockDoesNotExist("name=" + name); } BlockRegion region = imeBCIndex.getRegion(); return createReader(imeBCIndex.getCompressionAlgorithm(), region); }
/** * Stream access to a Meta Block. * * @param name * meta block name * @return BlockReader input stream for reading the meta block. * @throws IOException * @throws MetaBlockDoesNotExist * The Meta Block with the given name does not exist. */ public BlockReader getMetaBlock(String name) throws IOException, MetaBlockDoesNotExist { MetaIndexEntry imeBCIndex = metaIndex.getMetaByName(name); if (imeBCIndex == null) { throw new MetaBlockDoesNotExist("name=" + name); } BlockRegion region = imeBCIndex.getRegion(); return createReader(imeBCIndex.getCompressionAlgorithm(), region); }
/** * Stream access to a Meta Block. * * @param name * meta block name * @return BlockReader input stream for reading the meta block. * @throws IOException * @throws MetaBlockDoesNotExist * The Meta Block with the given name does not exist. */ public BlockReader getMetaBlock(String name) throws IOException, MetaBlockDoesNotExist { MetaIndexEntry imeBCIndex = metaIndex.getMetaByName(name); if (imeBCIndex == null) { throw new MetaBlockDoesNotExist("name=" + name); } BlockRegion region = imeBCIndex.getRegion(); return createReader(imeBCIndex.getCompressionAlgorithm(), region); }