Uh oh!
There was an error while loading. Please reload this page.
forked from gihanjayatilaka/Motify
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRSSFileHandling.java
More file actions
Latest commit
21 lines (20 loc) · 874 Bytes
/
Copy pathRSSFileHandling.java
File metadata and controls
21 lines (20 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
importjava.io.*;
importjava.util.ArrayList;
importjava.util.Collections;
publicclassRSSFileHandling {
staticpublicvoidsaveRSSData(ArrayList<NotificationUpdate> arrayToSave) throwsException{
FileOutputStreamfos=newFileOutputStream("RSSdata.dat");
ObjectOutputStreamoos=newObjectOutputStream(fos);
oos.writeInt(arrayToSave.size());
for(intx=0;x<arrayToSave.size();x++) oos.writeObject(arrayToSave.get(x));
}
staticpublicArrayList<NotificationUpdate> readRSSData() throwsException{
FileInputStreamfis=newFileInputStream("RSSdata.dat");
ObjectInputStreamois=newObjectInputStream(fis);
intN=ois.readInt();
ArrayList<NotificationUpdate> arrayBeingRead=newArrayList<NotificationUpdate>();
for(intx=0;x<N;x++) arrayBeingRead.add((NotificationUpdate) ois.readObject());
Collections.sort(arrayBeingRead);
returnarrayBeingRead;
}
}