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 pathReaderOne.java
More file actions
Latest commit
73 lines (59 loc) · 2.41 KB
/
Copy pathReaderOne.java
File metadata and controls
73 lines (59 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
importjava.io.*;
importjava.net.*;
importjava.nio.channels.Channels;
importjava.nio.channels.ReadableByteChannel;
importjava.util.Scanner;
importjava.util.ArrayList;
publicclassReaderOne {
@SuppressWarnings("resource")
publicstaticArrayList<Reminder> readURL(Stringurl) throwsException{
URLurlToRead=newURL(url);
ReadableByteChannelin=Channels.newChannel(urlToRead.openStream());
FileOutputStreamout=newFileOutputStream("icalexport.ics");
out.getChannel().transferFrom(in, 0, Long.MAX_VALUE);
returnreadFile("icalexport.ics");
}
publicstaticArrayList<Reminder> readFile(StringfileName) throwsException {
FilefileToReadFrom=newFile(fileName);
//System.out.println("THE FILE IS AT "+fileToReadFrom.getCanonicalPath());
Scannersc=newScanner(fileToReadFrom);
ArrayList<Reminder> reminders=newArrayList<Reminder>();
while(sc.hasNext()){
StringinputLine=sc.nextLine();
if(inputLine.equals("BEGIN:VEVENT")){
RemindercurrentReminder;
intUID=ReadingFunctions.getUID(sc.nextLine());
//System.out.println("UID READING"+UID);
Stringsummary=ReadingFunctions.getSummary(sc.nextLine());
//System.out.println("SUMMARY IS:"+summary);
Stringdescription=ReadingFunctions.getDescription(sc.nextLine());
//System.out.println(description+"!!!!!!!!!!!");
StringdescriptionNextLine=sc.next();
//System.out.println("$$$$"+descriptionNextLine);
if(!descriptionNextLine.equals("CLASS:PUBLIC")){
//System.out.println("FFFFFUCK");
while(!(descriptionNextLine.equals("CLASS:PUBLIC"))){
description=description+descriptionNextLine;
descriptionNextLine=sc.nextLine();
//System.out.println("description:"+description);
}
}
Stringaa=sc.nextLine();
if(aa.equals("")) aa=sc.nextLine();
//System.out.println("****"+aa+"000");
int[] dateModified=ReadingFunctions.getModifiedTime(aa);
//System.out.println("date modified added :P :P");
sc.nextLine();
Stringbb=sc.nextLine();
//System.out.println("END TIME IS"+bb);
int[] endTime=ReadingFunctions.getEndTime(bb);
//System.out.println("end time insterted");
Stringsubject=ReadingFunctions.getSubject(sc.nextLine());
//System.out.println("subject insterted");
currentReminder=newReminder(UID,subject,dateModified,endTime,summary,description);
reminders.add(currentReminder);
}
}
returnreminders;
}
}