<$ PostArgument pa = getPostArgument("dump"); byte[] data = null; if(pa != null) { data = pa.getData(); } final int COLS = 16; final int OFFSETLEN = 10; $> SlXHexEd <$ if(data != null) echo(""); $>
File:
Data length: " + data.length + " bytes


<$ if(data != null) { echo("
"); int col = 0; int count = 0; int rows = (int)Math.ceil((float)data.length / COLS); echo(""); for(int i = 0; i < rows; i++) { String offset = Integer.toString(i*COLS); StringBuilder offsetPadding = new StringBuilder(); while(offset.length() + offsetPadding.length() < OFFSETLEN) { offsetPadding.append("0"); } echo(""); } echo("
0x" + offsetPadding.toString() + offset + ":
"); echo("
"); echo(""); for(byte b: data) { if(col == 0) echo(""); String hex = Integer.toHexString(b&0xFF).toUpperCase(); if(hex.length() != 2) hex = "0" + hex; echo(""); col++; count++; if(col >= COLS) { echo(""); col = 0; } } boolean needFinal = false; while(col < COLS && col != 0) { echo(""); col++; needFinal = true; } if(needFinal) { echo(""); needFinal = false; } echo("
" + hex + "
"); echo("
"); echo(""); col = 0; count = 0; for(byte b: data) { if(col == 0) echo(""); echo(""); col++; count++; if(col >= COLS) { echo(""); col = 0; } } while(col < COLS && col != 0) { echo(""); col++; needFinal = true; } if(needFinal) { echo(""); needFinal = false; } echo("
" + (char)b + "
"); echo("
"); } $>