BlockMetadataHeader.readHeader(new DataInputStream( new BufferedInputStream(metaIn, BlockMetadataHeader .getHeaderSize())));
try (FileInputStream fis = fileIoProvider.getFileInputStream( this, metaFile)) { dcs = BlockMetadataHeader.readHeader(fis).getChecksum();
DataChecksum dcs = BlockMetadataHeader.readHeader(fis).getChecksum(); int checksumsize = dcs.getChecksumSize(); int bpc = dcs.getBytesPerChecksum();
metaStream = new FileInputStream(metaFile); checksumStream = new DataInputStream(metaStream); header = BlockMetadataHeader.readHeader(checksumStream); metaChannel = metaStream.getChannel(); metaChannel.position(HEADER_LEN);
try { BlockMetadataHeader header = BlockMetadataHeader.readHeader(metaRAF); checksum = header.getChecksum();
/** * This reads all the fields till the beginning of checksum. * @return Metadata Header * @throws IOException */ public static BlockMetadataHeader readHeader(DataInputStream in) throws IOException { return readHeader(in.readShort(), in); }
/** * This reads all the fields till the beginning of checksum. * @param in * @return Metadata Header * @throws IOException */ public static BlockMetadataHeader readHeader(DataInputStream in) throws IOException { return readHeader(in.readShort(), in); }
/** * This reads all the fields till the beginning of checksum. * @param in * @return Metadata Header * @throws IOException */ static BlockMetadataHeader readHeader(DataInputStream in) throws IOException { return readHeader(in.readShort(), in); }
/** * This reads all the fields till the beginning of checksum. * @return Metadata Header * @throws IOException */ public static BlockMetadataHeader readHeader(DataInputStream in) throws IOException { return readHeader(in.readShort(), in); }
/** * This reads all the fields till the beginning of checksum. * @param in * @param checksumImpl * @return Metadata Header * @throws IOException */ public static BlockMetadataHeader readHeader(DataInputStream in, Checksum checksumImpl) throws IOException { return readHeader(in.readShort(), in, checksumImpl); }
/** * This reads all the fields till the beginning of checksum. * @return Metadata Header * @throws IOException */ public static BlockMetadataHeader readHeader(DataInputStream in) throws IOException { return readHeader(in.readShort(), in); }
/** * 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()); }
/** * Reads header at the top of metadata file and returns the header. * Closes the input stream after reading the header. * * @return metadata header for the block * @throws IOException */ public static BlockMetadataHeader readHeader( FileInputStream fis) throws IOException { try (DataInputStream in = new DataInputStream( new BufferedInputStream(fis))) { return readHeader(in); } }
/** * Read the header at the beginning of the given block meta file. * The current file position will be altered by this method. * If an error occurs, the file is <em>not</em> closed. */ public static BlockMetadataHeader readHeader(RandomAccessFile raf) throws IOException { byte[] buf = new byte[getHeaderSize()]; raf.seek(0); raf.readFully(buf, 0, buf.length); return readHeader(new DataInputStream(new ByteArrayInputStream(buf))); }
/** * Read the header at the beginning of the given block meta file. * The current file position will be altered by this method. * If an error occurs, the file is <em>not</em> closed. */ public static BlockMetadataHeader readHeader(RandomAccessFile raf) throws IOException { byte[] buf = new byte[getHeaderSize()]; raf.seek(0); raf.readFully(buf, 0, buf.length); return readHeader(new DataInputStream(new ByteArrayInputStream(buf))); }
/** * Read the header at the beginning of the given block meta file. * The current file position will be altered by this method. * If an error occurs, the file is <em>not</em> closed. */ public static BlockMetadataHeader readHeader(RandomAccessFile raf) throws IOException { byte[] buf = new byte[getHeaderSize()]; raf.seek(0); raf.readFully(buf, 0, buf.length); return readHeader(new DataInputStream(new ByteArrayInputStream(buf))); }
/** * Reads header at the top of metadata file and returns the header. * * @return metadata header for the block * @throws IOException */ public static BlockMetadataHeader readHeader(File file) throws IOException { DataInputStream in = null; try { in = new DataInputStream(new BufferedInputStream( new FileInputStream(file))); return readHeader(in); } finally { IOUtils.closeStream(in); } }
/** * Read the checksum header from the meta input stream. * @return the data checksum obtained from the header. */ public static DataChecksum readDataChecksum(final DataInputStream metaIn, final Object name) throws IOException { // read and handle the common header here. For now just a version final BlockMetadataHeader header = readHeader(metaIn); if (header.getVersion() != VERSION) { LOG.warn("Unexpected meta-file version for " + name + ": version in file is " + header.getVersion() + " but expected version is " + VERSION); } return header.getChecksum(); }
/** * Read the checksum header from the meta input stream. * @return the data checksum obtained from the header. */ public static DataChecksum readDataChecksum(final DataInputStream metaIn, final Object name) throws IOException { // read and handle the common header here. For now just a version final BlockMetadataHeader header = readHeader(metaIn); if (header.getVersion() != VERSION) { LOG.warn("Unexpected meta-file version for " + name + ": version in file is " + header.getVersion() + " but expected version is " + VERSION); } return header.getChecksum(); }
/** * Read the checksum header from the meta input stream. * @return the data checksum obtained from the header. */ public static DataChecksum readDataChecksum(final DataInputStream metaIn, final Object name) throws IOException { // read and handle the common header here. For now just a version final BlockMetadataHeader header = readHeader(metaIn); if (header.getVersion() != VERSION) { LOG.warn("Unexpected meta-file version for " + name + ": version in file is " + header.getVersion() + " but expected version is " + VERSION); } return header.getChecksum(); }