Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HttpConnection h = new HttpConnection();
- InputStream input = h.openInputStream();
- int len = (int) h.httpConn.getLength();
- StringBuffer raw = new StringBuffer();
- if(len > 0)
- {
- byte[] data = new byte[len];
- while( -1 != (len = input.read(data)))
- {
- raw.append(new String(data, 0, len));
- }
- }
- response = raw.toString();
- input.close();
- h.httpConn.close();
- //System.out.println("Response -----> " + response);
- return response;
- public String getContents(InputStream stream) {
- String contents = null;
- try{
- contents = new String(IOUtilities.streamToBytes(stream), "UTF-8");
- }
- catch(Exception e) {
- //encoding error
- }
- return contents;
- }
Add Comment
Please, Sign In to add comment