问题:org.apache.commons.fileupload.FileItemStream$ItemSkippedException
因为解析post request的时候把inputstream放在了集合中,打算事后统一处理,如下,这样就出现了这个问题。
1 |
|
官网给出的解释是:
This exception is thrown, if an attempt is made to read data from the InputStream, which has been returned by FileItemStream.openStream(), after Iterator.hasNext() has been invoked on the iterator, which created the FileItemStream.
最后我的解决方法是:把inputstream先转为bytearray,然后再转化为InputStream,如下。会不会太耗内存?
1 | byte[] bytes = IOUtils.toByteArray(stream); |