static Exchange createOutOnlyExchangeWithBodyAndHeaders ( WebcamEndpoint endpoint , BufferedImage image ) throws IOException { Exchange exchange = endpoint . createExchange ( ExchangePattern . OutOnly ) ; Message message = exchange . getIn ( ) ; try ( ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ) { ImageIO . write ( image , endpoint . getFormat ( ) , output ) ; message . setBody ( new BufferedInputStream ( new ByteArrayInputStream ( output . toByteArray ( ) ) ) ) ; message . setHeader ( Exchange . FILE_NAME , message . getMessageId ( ) + "" + endpoint . getFormat ( ) ) ; } return exchange ; }
Creates an OutOnly exchange with the BufferedImage .