Here you can find the source of getFileContent(InputStream inputStream)
private static String getFileContent(InputStream inputStream)
//package com.java2s; import java.io.IOException; import java.io.InputStream; public class Main { private static String getFileContent(InputStream inputStream) { byte[] bytes = new byte[28]; try {/* w ww. jav a 2 s.c o m*/ inputStream.read(bytes, 0, 28); } catch (IOException e) { throw new RuntimeException("read file content error!"); } return bytesToHexString(bytes); } private static String bytesToHexString(byte[] src) { if (null == src || src.length == 0) return null; StringBuilder sb = new StringBuilder(); for (byte b : src) { String hv = Integer.toHexString(b & 0xFF); if (hv.length() < 2) sb.append(0); sb.append(hv); } return sb.toString(); } }