public static List<ReconcilationDTO> analyse(InputStream fstream, List<Order> orders) { List<ReconcilationDTO> rs = new ArrayList<ReconcilationDTO>(); try { DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; String sdate = ""; while ((strLine = br.readLine()) != null) { // System.out.println(strLine); if (strLine != null) { if (strLine.startsWith("0")) { sdate = StringUtil.split(strLine, "|")[2]; SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); sdate = new SimpleDateFormat("dd MMM yyyy").format(format.parse(sdate)); } else if (strLine.startsWith("1")) { List<ReconcilationDTO> dtos = getDTO(strLine, orders); for (ReconcilationDTO dto : dtos) { dto.setDate(sdate); rs.add(dto); } } } } in.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } return rs; }