public BufferedImage buildBufferedImageOfIconInOS ( Path path ) { path = JMOptional . getNullableAndFilteredOptional ( path , JMPath . NotExistFilter ) . flatMap ( JMPathOperation :: createTempFilePathAsOpt ) . orElse ( path ) ; Icon iconInOS = os . getIcon ( path . toFile ( ) ) ; BufferedImage bufferedImage = new BufferedImage ( iconInOS . getIconWidth ( ) , iconInOS . getIconHeight ( ) , BufferedImage . TYPE_INT_ARGB ) ; iconInOS . paintIcon ( null , bufferedImage . getGraphics ( ) , 0 , 0 ) ; return bufferedImage ; }
Build buffered image of icon in os buffered image .