Esempio n. 1
0
  @Override
  public ServletInputStream getInputStream() throws IOException {
    if (servletInputStream == null) {
      final InputStream in = bodyPipedStream.getInputStream();
      servletInputStream =
          new ServletInputStream() {

            @Override
            public int read() throws IOException {
              return in.read();
            }

            @Override
            public int available() throws IOException {
              return in.available();
            }

            @Override
            public void close() throws IOException {
              in.close();
            }

            public int read(byte[] b, int off, int len) throws IOException {
              return in.read(b, off, len);
            }
          };
    }
    return servletInputStream;
  }
Esempio n. 2
0
 @Override
 public BufferedReader getReader() throws IOException {
   if (bufferedReader == null) {
     bufferedReader =
         new BufferedReader(
             new InputStreamReader(bodyPipedStream.getInputStream(), characterEncoding));
   }
   return bufferedReader;
 }