org.apache.hadoop.hbase.io.hfile.HFile.checkFormatVersion()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.hadoop.hbase.io.hfile.HFile.checkFormatVersion()方法的一些代码示例,展示了HFile.checkFormatVersion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HFile.checkFormatVersion()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.io.hfile.HFile
类名称:HFile
方法名:checkFormatVersion

HFile.checkFormatVersion介绍

[英]Checks the given HFile format version, and throws an exception if invalid. Note that if the version number comes from an input file and has not been verified, the caller needs to re-throw an IOException to indicate that this is not a software error, but corrupted input.
[中]检查给定的HFile格式版本,如果无效,则引发异常。请注意,如果版本号来自输入文件且未经验证,则调用者需要重新引发IOException,以指示这不是软件错误,而是已损坏的输入。

代码示例

代码示例来源:origin: apache/hbase

FixedFileTrailer(int majorVersion, int minorVersion) {
 this.majorVersion = majorVersion;
 this.minorVersion = minorVersion;
 HFile.checkFormatVersion(majorVersion);
}

代码示例来源:origin: apache/hbase

public static int getFormatVersion(Configuration conf) {
 int version = conf.getInt(FORMAT_VERSION_KEY, MAX_FORMAT_VERSION);
 checkFormatVersion(version);
 return version;
}

代码示例来源:origin: apache/hbase

/**
 * Write the trailer to a data stream. We support writing version 1 for
 * testing and for determining version 1 trailer size. It is also easy to see
 * what fields changed in version 2.
 *
 * @param outputStream
 * @throws IOException
 */
void serialize(DataOutputStream outputStream) throws IOException {
 HFile.checkFormatVersion(majorVersion);
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 DataOutputStream baosDos = new DataOutputStream(baos);
 BlockType.TRAILER.write(baosDos);
 serializeAsPB(baosDos);
 // The last 4 bytes of the file encode the major and minor version universally
 baosDos.writeInt(materializeVersion(majorVersion, minorVersion));
 baos.writeTo(outputStream);
}

代码示例来源:origin: apache/hbase

int minorVersion = extractMinorVersion(version);
HFile.checkFormatVersion(majorVersion); // throws IAE if invalid

代码示例来源:origin: apache/hbase

/**
 * Deserialize the fixed file trailer from the given stream. The version needs
 * to already be specified. Make sure this is consistent with
 * {@link #serialize(DataOutputStream)}.
 *
 * @param inputStream
 * @throws IOException
 */
void deserialize(DataInputStream inputStream) throws IOException {
 HFile.checkFormatVersion(majorVersion);
 BlockType.TRAILER.readAndCheck(inputStream);
 if (majorVersion > 2
   || (majorVersion == 2 && minorVersion >= HFileReaderImpl.PBUF_TRAILER_MINOR_VERSION)) {
  deserializeFromPB(inputStream);
 } else {
  deserializeFromWritable(inputStream);
 }
 // The last 4 bytes of the file encode the major and minor version universally
 int version = inputStream.readInt();
 expectMajorVersion(extractMajorVersion(version));
 expectMinorVersion(extractMinorVersion(version));
}

代码示例来源:origin: co.cask.hbase/hbase

FixedFileTrailer(int majorVersion, int minorVersion) {
 this.majorVersion = majorVersion;
 this.minorVersion = minorVersion;
 HFile.checkFormatVersion(majorVersion);
}

代码示例来源:origin: harbby/presto-connectors

FixedFileTrailer(int majorVersion, int minorVersion) {
 this.majorVersion = majorVersion;
 this.minorVersion = minorVersion;
 HFile.checkFormatVersion(majorVersion);
}

代码示例来源:origin: co.cask.hbase/hbase

public static int getFormatVersion(Configuration conf) {
 int version = conf.getInt(FORMAT_VERSION_KEY, MAX_FORMAT_VERSION);
 checkFormatVersion(version);
 return version;
}

代码示例来源:origin: harbby/presto-connectors

public static int getFormatVersion(Configuration conf) {
 int version = conf.getInt(FORMAT_VERSION_KEY, MAX_FORMAT_VERSION);
 checkFormatVersion(version);
 return version;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Write the trailer to a data stream. We support writing version 1 for
 * testing and for determining version 1 trailer size. It is also easy to see
 * what fields changed in version 2.
 *
 * @param outputStream
 * @throws IOException
 */
void serialize(DataOutputStream outputStream) throws IOException {
 HFile.checkFormatVersion(majorVersion);
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 DataOutputStream baosDos = new DataOutputStream(baos);
 BlockType.TRAILER.write(baosDos);
 serializeAsPB(baosDos);
 // The last 4 bytes of the file encode the major and minor version universally
 baosDos.writeInt(materializeVersion(majorVersion, minorVersion));
 baos.writeTo(outputStream);
}

代码示例来源:origin: co.cask.hbase/hbase

HFile.checkFormatVersion(majorVersion);

代码示例来源:origin: harbby/presto-connectors

int minorVersion = extractMinorVersion(version);
HFile.checkFormatVersion(majorVersion); // throws IAE if invalid

代码示例来源:origin: co.cask.hbase/hbase

int minorVersion = extractMinorVersion(version);
HFile.checkFormatVersion(majorVersion); // throws IAE if invalid

代码示例来源:origin: co.cask.hbase/hbase

HFile.checkFormatVersion(majorVersion);

代码示例来源:origin: harbby/presto-connectors

/**
 * Deserialize the fixed file trailer from the given stream. The version needs
 * to already be specified. Make sure this is consistent with
 * {@link #serialize(DataOutputStream)}.
 *
 * @param inputStream
 * @throws IOException
 */
void deserialize(DataInputStream inputStream) throws IOException {
 HFile.checkFormatVersion(majorVersion);
 BlockType.TRAILER.readAndCheck(inputStream);
 if (majorVersion > 2
   || (majorVersion == 2 && minorVersion >= HFileReaderV2.PBUF_TRAILER_MINOR_VERSION)) {
  deserializeFromPB(inputStream);
 } else {
  deserializeFromWritable(inputStream);
 }
 // The last 4 bytes of the file encode the major and minor version universally
 int version = inputStream.readInt();
 expectMajorVersion(extractMajorVersion(version));
 expectMinorVersion(extractMinorVersion(version));
}

相关文章