public static File getResourceDirectory ( final File baseDirectory , final IRI identifier ) { requireNonNull ( baseDirectory , "The baseDirectory may not be null!" ) ; requireNonNull ( identifier , "The identifier may not be null!" ) ; final String id = identifier . getIRIString ( ) ; final StringJoiner joiner = new StringJoiner ( separator ) ; final CRC32 hasher = new CRC32 ( ) ; hasher . update ( id . getBytes ( UTF_8 ) ) ; final String intermediate = Long . toHexString ( hasher . getValue ( ) ) ; range ( 0 , intermediate . length ( ) / LENGTH ) . limit ( MAX ) . forEach ( i -> joiner . add ( intermediate . substring ( i * LENGTH , ( i + 1 ) * LENGTH ) ) ) ; joiner . add ( md5Hex ( id ) ) ; return new File ( baseDirectory , joiner . toString ( ) ) ; }
Get a directory for a given resource identifier .