@Override public InputStream getInputStream() throws IOException, IllegalStateException { verifyExists(); return super.getInputStream(); }
@Override public InputStream getInputStream() throws IOException, IllegalStateException { verifyExists(); return super.getInputStream(); }
@Override public InputStream getInputStream() throws IOException, IllegalStateException { return super.getInputStream(); //To change body of generated methods, choose Tools | Templates. }
@RequestMapping(value = "{cluster}/{appId}/compose", method = POST, consumes = {APPLICATION_OCTET_STREAM_VALUE}) public ResponseEntity<Application> uploadComposeFileAsStream(@PathVariable("cluster") String cluster, @PathVariable("appId") String appId, @RequestBody InputStreamResource resource) throws Exception { try (InputStream inputStream = resource.getInputStream()) { File file = ComposeUtils.applicationPath(composeExecutor.getBasedir(), cluster, appId, null, true); byte[] buffer = new byte[inputStream.available()]; inputStream.read(buffer); Files.write(buffer, file); return launchComposeFile(file, cluster, appId); } }
private Resource getFormResource(Object arg) { if (byte[].class == arg.getClass()) { return new ByteArrayResource((byte[]) arg); } else if (Resource.class.isAssignableFrom(arg.getClass())) { return (Resource) arg; } else if (InputStreamSource.class.isAssignableFrom(arg.getClass())) { try { return new InputStreamResource(((InputStreamResource) arg).getInputStream()); } catch (IOException e) { logger.error(e.getMessage(), e); throw new WxAppException("处理IO转换异常", e); } } else if (File.class.isAssignableFrom(arg.getClass())) { return new FileSystemResource((File) arg); } else if (InputStream.class.isAssignableFrom(arg.getClass())) { return new InputStreamResource((InputStream) arg); } else if (Reader.class.isAssignableFrom(arg.getClass())) { Reader reader = (Reader) arg; ReaderInputStream readerInputStream = new ReaderInputStream(reader, StandardCharsets.UTF_8); return new InputStreamResource(readerInputStream); } throw new WxAppException("不支持的Resource类型"); }
input = new InputStreamResource(resource.getInputStream()).getInputStream(); }else{ input = resource.getInputStream();