public static Optional < Path > createTempFilePathAsOpt ( Path path ) { debug ( log , "createTempFilePathAsOpt" , path ) ; String [ ] prefixSuffix = JMFiles . getPrefixSuffix ( path . toFile ( ) ) ; try { return Optional . of ( Files . createTempFile ( prefixSuffix [ 0 ] , prefixSuffix [ 1 ] ) ) . filter ( JMPath . ExistFilter ) . map ( JMPathOperation :: deleteOnExit ) ; } catch ( Exception e ) { return JMExceptionManager . handleExceptionAndReturnEmptyOptional ( log , e , "createTempFilePathAsOpt" , path ) ; } }
Create temp file path as opt optional .