public ArrayList<FIncomePO> findbyHall(String hall) throws RemoteException, IOException { ArrayList<FIncomePO> income = new ArrayList<FIncomePO>(); ObjectInputStream os = null; System.out.println("start find!"); try { FileInputStream fs = new FileInputStream(file); os = new ObjectInputStream(fs); FIncomePO po = (FIncomePO) os.readObject(); while (fs.available() > 0) { byte[] buf = new byte[4]; fs.read(buf); FIncomePO incomepo = (FIncomePO) os.readObject(); if (incomepo.getShop().equals(hall)) { income.add(incomepo); } } return income; } catch (Exception e) { return null; } finally { os.close(); } }
public ArrayList<FIncomePO> findHallTime(String time1, String time2, String hall) throws RemoteException, IOException { ArrayList<FIncomePO> timeList = this.findByTime(time1, time2); ArrayList<FIncomePO> result = new ArrayList<FIncomePO>(); if (timeList.isEmpty()) { return null; } for (int i = 0; i < timeList.size(); i++) { FIncomePO po = timeList.get(i); if (po.getShop().equals(hall)) result.add(po); } return result; }