Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ArrayList<Flat> retreiveFlat() throws ClassNotFoundException, IOException {
- FileInputStream fis = new FileInputStream("path/Flat.ser");
- ObjectInputStream ois = new ObjectInputStream(fis);
- Flat f;
- ArrayList<Flat> al = new ArrayList<Flat>();
- while (fis.available() > 0) {
- Object retrieved = ois.readObject();
- if(retrieved instanceof Flat) {
- f = (Flat) retrieved;
- if(f.getTypeOfFlat().equals("Double")) {
- al.add(f);
- }
- }
- }
- ois.close();
- return al;
- }
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <%@ page import="Entity.Flat" %>
- <%@ page import="java.util.*" %>
- <%
- ArrayList<Flat> al = new ArrayList<Flat>();
- al = Flat.retreiveFlat();
- int i = 0;
- while(al.get(i) != null){
- //do something
- i++;}%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement