public static Path sourcePathFromParityPath ( Path parityPath , FileSystem fs ) throws IOException { String parityPathStr = parityPath . toUri ( ) . getPath ( ) ; for ( Codec codec : Codec . getCodecs ( ) ) { String prefix = codec . getParityPrefix ( ) ; if ( parityPathStr . startsWith ( prefix ) ) { // Remove the prefix to get the source file. String src = parityPathStr . replaceFirst ( prefix , Path . SEPARATOR ) ; Path srcPath = new Path ( src ) ; if ( fs . exists ( srcPath ) ) { return srcPath ; } } } return null ; }
returns the source file corresponding to a parity file