swen922

Untitled

Mar 20th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. public String getInputString(HttpServletRequest req) {
  2.         String receivedString = "";
  3.  
  4.         int len = req.getContentLength();
  5.         byte[] input = new byte[len];
  6.  
  7.         try {
  8.             ServletInputStream sin = req.getInputStream();
  9.             int c = 0;
  10.             int count = 0;
  11.             while ((c = sin.read(input, count, (input.length - count))) > 0) {
  12.                 count += 1;
  13.             }
  14.             sin.close();
  15.         } catch (IOException e) {
  16.             AllData.status = "Updater.getInputString - Ошибка обновления! Выброшено исключение! ";
  17.             AllData.logger.error(AllData.status);
  18.             AllData.logger.error(e.getMessage(), e);
  19.             e.printStackTrace();
  20.         }
  21.  
  22.         receivedString = new String(input);
  23.  
  24.         return receivedString;
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment