@Override public void execute() throws IOException { final String richMenuId = checkNotNull(arguments.getRichMenuId(), "--rich-menu-id= is not set."); final String out = checkNotNull(arguments.getOut(), "--out= is not set."); final MessageContentResponse messageContentResponse = getUnchecked(lineMessagingClient.getRichMenuImage(richMenuId)); log.info("Request Successfully finished. {}", messageContentResponse); try (OutputStream os = new FileOutputStream(out)) { StreamUtils.copy(messageContentResponse.getStream(), os); } log.info("Successfully finished. Output = {}", out); } }