We are using java 6. I need to check "inputStream" is null or not.
@POST
@Path("/test")
@ApiOperation ( value = "Test", response = String.class)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public String test(
@ApiParam(value = "file upload") @FormDataParam("file") InputStream is
) {
return is.read();
}
The inputStream returns "117" while reading even when we didn't upload file.
- I have read inputStream used
inputStream.available()
it always returns"0"
I have searched through google some links suggested to use
"PushbackInputStream"
(PushbackInputStream)PushbackInputStream is support for jdk-7 but we are using jdk-6
- how to solve this issue??
How to check if the inputStream is null???