@Override public LengthInputStream getMetadataInputStream(long offset) throws IOException { return new LengthInputStream(new ByteArrayInputStream(NULL_CHECKSUM_ARRAY), NULL_CHECKSUM_ARRAY.length); }
/** * @return the FileInputStream for the meta data of the given block. * @throws FileNotFoundException * if the file not found. * @throws ClassCastException * if the underlying input stream is not a FileInputStream. */ public static FileInputStream getMetaDataInputStream( ExtendedBlock b, FsDatasetSpi<?> data) throws IOException { final LengthInputStream lin = data.getMetaDataInputStream(b); if (lin == null) { throw new FileNotFoundException("Meta file for " + b + " not found."); } return (FileInputStream)lin.getWrappedStream(); } }
metaIn.getLength() >= BlockMetadataHeader.getHeaderSize()) { checksumIn = new DataInputStream(new BufferedInputStream( metaIn, IO_FILE_BUFFER_SIZE));
/** * Read block metadata header. * * @throws IOException */ void readHeader() throws IOException { //read metadata file header = BlockMetadataHeader.readHeader(checksumIn); checksum = header.getChecksum(); setChecksumSize(checksum.getChecksumSize()); setBytesPerCRC(checksum.getBytesPerChecksum()); long crcPerBlock = checksum.getChecksumSize() <= 0 ? 0 : (metadataIn.getLength() - BlockMetadataHeader.getHeaderSize()) / checksum.getChecksumSize(); setCrcPerBlock(crcPerBlock); setCrcType(checksum.getChecksumType()); }
@Override public LengthInputStream getMetadataInputStream(long offset) throws IOException { final File meta = getMetaFile(); return new LengthInputStream( getFileIoProvider().openAndSeek(getVolume(), meta, offset), meta.length()); }
final int bytesPerCRC = checksum.getBytesPerChecksum(); final long crcPerBlock = csize <= 0 ? 0 : (metadataIn.getLength() - BlockMetadataHeader.getHeaderSize()) / csize;
/** * @return the FileInputStream for the meta data of the given block. * @throws FileNotFoundException * if the file not found. * @throws ClassCastException * if the underlying input stream is not a FileInputStream. */ public static FileInputStream getMetaDataInputStream( ExtendedBlock b, FsDatasetSpi<?> data) throws IOException { final LengthInputStream lin = data.getMetaDataInputStream(b); if (lin == null) { throw new FileNotFoundException("Meta file for " + b + " not found."); } return (FileInputStream)lin.getWrappedStream(); } }
@Override public LengthInputStream getMetaDataInputStream(ExtendedBlock b) throws IOException { return new LengthInputStream(null, 0); }
metaIn.getLength() >= BlockMetadataHeader.getHeaderSize()) { checksumIn = new DataInputStream(new BufferedInputStream( metaIn, HdfsConstants.IO_FILE_BUFFER_SIZE));
/** * @return the FileInputStream for the meta data of the given block. * @throws FileNotFoundException * if the file not found. * @throws ClassCastException * if the underlying input stream is not a FileInputStream. */ public static FileInputStream getMetaDataInputStream( ExtendedBlock b, FsDatasetSpi<?> data) throws IOException { final LengthInputStream lin = data.getMetaDataInputStream(b); if (lin == null) { throw new FileNotFoundException("Meta file for " + b + " not found."); } return (FileInputStream)lin.getWrappedStream(); } }
@Override // FsDatasetSpi public LengthInputStream getMetaDataInputStream(ExtendedBlock b) throws IOException { File meta = FsDatasetUtil.getMetaFile(getBlockFile(b), b.getGenerationStamp()); if (meta == null || !meta.exists()) { return null; } if (isNativeIOAvailable) { return new LengthInputStream( NativeIO.getShareDeleteFileInputStream(meta), meta.length()); } return new LengthInputStream(new FileInputStream(meta), meta.length()); }
final int bytesPerCRC = checksum.getBytesPerChecksum(); final long crcPerBlock = csize <= 0 ? 0 : (metadataIn.getLength() - BlockMetadataHeader.getHeaderSize()) / csize;
@Override // FsDatasetSpi public LengthInputStream getMetaDataInputStream(ExtendedBlock b) throws IOException { File meta = FsDatasetUtil.getMetaFile(getBlockFile(b), b.getGenerationStamp()); if (meta == null || !meta.exists()) { return null; } if (isNativeIOAvailable) { return new LengthInputStream( NativeIO.getShareDeleteFileInputStream(meta), meta.length()); } return new LengthInputStream(new FileInputStream(meta), meta.length()); }
metaIn.getLength() >= BlockMetadataHeader.getHeaderSize()) { checksumIn = new DataInputStream(new BufferedInputStream( metaIn, HdfsConstants.IO_FILE_BUFFER_SIZE));
@Override // FsDatasetSpi public synchronized LengthInputStream getMetaDataInputStream(ExtendedBlock b ) throws IOException { BInfo binfo = getBlockMap(b).get(b.getLocalBlock()); if (binfo == null) { throw new IOException("No such Block " + b ); } if (!binfo.finalized) { throw new IOException("Block " + b + " is being written, its meta cannot be read"); } final SimulatedInputStream sin = binfo.getMetaIStream(); return new LengthInputStream(sin, sin.getLength()); }
@Override // FsDatasetSpi public synchronized LengthInputStream getMetaDataInputStream(ExtendedBlock b ) throws IOException { final Map<Block, BInfo> map = getMap(b.getBlockPoolId()); BInfo binfo = map.get(b.getLocalBlock()); if (binfo == null) { throw new IOException("No such Block " + b ); } if (!binfo.finalized) { throw new IOException("Block " + b + " is being written, its meta cannot be read"); } final SimulatedInputStream sin = binfo.getMetaIStream(); return new LengthInputStream(sin, sin.getLength()); }