What type of Groovy (or Java) transfer that supports "inputStream"?

I have such a method.

def process(file){
  if(file != null && !file.empty){
   anotherMethod(file.inputStream);
  }
}

If I call this method from Java, what type of object do I need to pass to this method? I tried File, ZipFile, but they do not have an empty method.

+4
source share
1 answer

It is impossible to say for a specific without seeing more context (for example, this method is usually called from a Grails application, for example), but the possible candidate would be MultipartFile , or rather, one of its specific implementations, such as MockMultipartFile . The properties emptyand inputStreamaccessed by the groovy code correspond to the access isEmpty()and getInputStream()bean methods of this interface.

multipart/form-data - , , request.getFile('fieldName') .

+1

All Articles