format/src/main/java/com/github/sadikovi/riff/Metadata.java
/**
     * Read metadata file and return deserialized metadata.
     * @param ignoreNotFound when true, ignore read and return null if metadata is not found
     * @return metadata instance of null if not found
     * @throws IOException
     */
Read metadata file and return deserialized metadata.
@param ignoreNotFound when true, ignore read and return null if metadata is not found
@return metadata instance of null if not found
@throws IOException
Read metadata file and return deserialized metadata . @param ignoreNotFound when true ignore read and return null if metadata is not found @return metadata instance of null if not found @throws IOException
public Metadata readMetadataFile(boolean ignoreNotFound) throws IOException {
      if (!fs.exists(metadataPath) && ignoreNotFound) {
        return null;
      }
      FileStatus status = fs.getFileStatus(metadataPath);
      Path parent = status.isDirectory() ? status.getPath() : status.getPath().getParent();
      Path metadataPath = new Path(parent, METADATA_FILENAME);
      if (!fs.exists(metadataPath) && ignoreNotFound) {
        return null;
      }
      FSDataInputStream in = null;
      try {
        Metadata metadata = new Metadata();
        in = fs.open(metadataPath);
        metadata.readFrom(in);
        return metadata;
      } finally {
        if (in != null) {
          in.close();
        }
      }
    }
public Metadata readMetadataFile ( boolean ignoreNotFound ) throws IOException { if ( ! fs . exists ( metadataPath ) && ignoreNotFound ) { return null ; } FileStatus status = fs . getFileStatus ( metadataPath ) ; Path parent = status . isDirectory ( ) ? status . getPath ( ) : status . getPath ( ) . getParent ( ) ; Path metadataPath = new Path ( parent , METADATA_FILENAME ) ; if ( ! fs . exists ( metadataPath ) && ignoreNotFound ) { return null ; } FSDataInputStream in = null ; try { Metadata metadata = new Metadata ( ) ; in = fs . open ( metadataPath ) ; metadata . readFrom ( in ) ; return metadata ; } finally { if ( in != null ) { in . close ( ) ; } } }
Read metadata file and return deserialized metadata.
Read metadata file and return deserialized metadata .
// if `ignoreNotFound` flag is set to true, we ignore errors associated with locating // metadata file, e.g. when directory of part files does not contain metadata // otherwise create input stream and read metadata