Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (be.isRepeatable()) {
- try {
- System.out.println();
- System.out.println(be.getContentType());
- if (null != be.getContentEncoding()) {
- System.out.println(be.getContentEncoding());
- }
- System.out.println("Content-Length: " + be.getContentLength());
- try (InputStream is = be.getContent()) {
- int pos = 0;
- byte[] bytes = new byte[24];
- int c;
- while (-1 != (c = is.read(bytes))) {
- StringBuilder sb = new StringBuilder();
- sb.append(String.format("%08x ", pos));
- for (int i = 0; i < c; i++) {
- sb.append(String.format("%02x ", bytes[i]));
- }
- for (int i = c; i < bytes.length; i++) {
- sb.append(" ");
- }
- sb.append(" ");
- for (int i = 0; i < c; i++) {
- sb.append(String.format("%c", (bytes[i] >= 32 && bytes[i] < 127) ? bytes[i] : '.'));
- }
- pos += c;
- System.out.println(sb.toString());
- }
- } finally {
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment