├── .gitignore ├── docs ├── vcal-10.pdf ├── rfc2445-ical.pdf ├── rfc5545-ical.pdf ├── rfc6321-xcal.pdf ├── rfc7265-jcal.pdf ├── rfc6868-circumflex.pdf └── draft-ietf-calext-extensions-01.pdf ├── src ├── main │ ├── java │ │ └── biweekly │ │ │ ├── io │ │ │ ├── package-info.java │ │ │ ├── chain │ │ │ │ └── package-info.java │ │ │ ├── json │ │ │ │ └── package-info.java │ │ │ ├── scribe │ │ │ │ ├── component │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── VTodoScribe.java │ │ │ │ │ ├── VEventScribe.java │ │ │ │ │ ├── StandardTimeScribe.java │ │ │ │ │ ├── DaylightSavingsTimeScribe.java │ │ │ │ │ ├── RawComponentScribe.java │ │ │ │ │ ├── ObservanceScribe.java │ │ │ │ │ ├── VJournalScribe.java │ │ │ │ │ └── VTimezoneScribe.java │ │ │ │ ├── package-info.java │ │ │ │ └── property │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── PriorityScribe.java │ │ │ │ │ ├── SequenceScribe.java │ │ │ │ │ ├── UidScribe.java │ │ │ │ │ ├── NameScribe.java │ │ │ │ │ ├── ColorScribe.java │ │ │ │ │ ├── DateDueScribe.java │ │ │ │ │ ├── DateEndScribe.java │ │ │ │ │ ├── SummaryScribe.java │ │ │ │ │ ├── LocationScribe.java │ │ │ │ │ ├── CompletedScribe.java │ │ │ │ │ ├── UrlScribe.java │ │ │ │ │ ├── ProductIdScribe.java │ │ │ │ │ ├── RelatedToScribe.java │ │ │ │ │ ├── DescriptionScribe.java │ │ │ │ │ ├── LastModifiedScribe.java │ │ │ │ │ ├── SourceScribe.java │ │ │ │ │ ├── ExceptionRuleScribe.java │ │ │ │ │ ├── ClassificationScribe.java │ │ │ │ │ ├── RecurrenceRuleScribe.java │ │ │ │ │ ├── ResourcesScribe.java │ │ │ │ │ ├── CategoriesScribe.java │ │ │ │ │ ├── RepeatScribe.java │ │ │ │ │ ├── CreatedScribe.java │ │ │ │ │ ├── ActionScribe.java │ │ │ │ │ ├── MethodScribe.java │ │ │ │ │ ├── CommentScribe.java │ │ │ │ │ ├── ContactScribe.java │ │ │ │ │ ├── TimezoneScribe.java │ │ │ │ │ ├── TimezoneIdScribe.java │ │ │ │ │ ├── TimezoneNameScribe.java │ │ │ │ │ ├── CalendarScaleScribe.java │ │ │ │ │ ├── PercentCompleteScribe.java │ │ │ │ │ ├── RecurrenceIdScribe.java │ │ │ │ │ ├── TimezoneUrlScribe.java │ │ │ │ │ ├── TimezoneOffsetToScribe.java │ │ │ │ │ ├── TimezoneOffsetFromScribe.java │ │ │ │ │ ├── ImageScribe.java │ │ │ │ │ └── StatusScribe.java │ │ │ ├── xml │ │ │ │ ├── package-info.java │ │ │ │ └── XCalQNames.java │ │ │ ├── text │ │ │ │ └── package-info.java │ │ │ ├── SkipMeException.java │ │ │ └── GlobalTimezoneIdResolver.java │ │ │ ├── util │ │ │ ├── package-info.java │ │ │ ├── Frequency.java │ │ │ ├── IOUtils.java │ │ │ ├── com │ │ │ │ └── google │ │ │ │ │ └── ical │ │ │ │ │ ├── util │ │ │ │ │ └── Predicate.java │ │ │ │ │ ├── values │ │ │ │ │ └── DateTimeValue.java │ │ │ │ │ └── compat │ │ │ │ │ └── javautil │ │ │ │ │ └── DateIterable.java │ │ │ └── Utf8Reader.java │ │ │ ├── property │ │ │ ├── package-info.java │ │ │ ├── UtcOffsetProperty.java │ │ │ ├── IntegerProperty.java │ │ │ ├── TextProperty.java │ │ │ ├── DateTimeProperty.java │ │ │ └── TimezoneId.java │ │ │ ├── component │ │ │ └── package-info.java │ │ │ └── parameter │ │ │ ├── package-info.java │ │ │ └── EnumParameterValue.java │ ├── resources │ │ └── biweekly │ │ │ ├── biweekly.properties │ │ │ └── biweekly.license │ └── javadoc │ │ └── biweekly │ │ ├── doc-files │ │ └── shBrushJava.js │ │ ├── io │ │ ├── doc-files │ │ │ └── shBrushJava.js │ │ ├── chain │ │ │ └── doc-files │ │ │ │ └── shBrushJava.js │ │ ├── json │ │ │ └── doc-files │ │ │ │ └── shBrushJava.js │ │ ├── scribe │ │ │ ├── doc-files │ │ │ │ └── shBrushJava.js │ │ │ ├── component │ │ │ │ └── doc-files │ │ │ │ │ └── shBrushJava.js │ │ │ └── property │ │ │ │ └── doc-files │ │ │ │ └── shBrushJava.js │ │ ├── text │ │ │ └── doc-files │ │ │ │ └── shBrushJava.js │ │ └── xml │ │ │ └── doc-files │ │ │ └── shBrushJava.js │ │ ├── util │ │ └── doc-files │ │ │ └── shBrushJava.js │ │ ├── component │ │ └── doc-files │ │ │ └── shBrushJava.js │ │ ├── parameter │ │ └── doc-files │ │ │ └── shBrushJava.js │ │ └── property │ │ └── doc-files │ │ └── shBrushJava.js └── test │ ├── resources │ └── biweekly │ │ ├── util │ │ └── base64.jpg │ │ ├── io │ │ ├── text │ │ │ ├── vcal-example2.vcs │ │ │ ├── vcal-example1.vcs │ │ │ ├── vcal-example3.vcs │ │ │ ├── rfc5545-example6.ics │ │ │ ├── rfc5545-example1.ics │ │ │ ├── rfc5545-example4.ics │ │ │ ├── rfc5545-example3.ics │ │ │ ├── rfc5545-example2.ics │ │ │ ├── rfc5545-example5.ics │ │ │ └── outlook-2010.ics │ │ ├── json │ │ │ └── rfc7265-example1.json │ │ └── xml │ │ │ └── rfc6321-example1.xml │ │ └── issues │ │ ├── pr63.ics │ │ ├── issue67.json │ │ ├── issue126.ics │ │ ├── issue85.ics │ │ ├── issue85-1980.ics │ │ └── issue101.ics │ └── java │ └── biweekly │ ├── issues │ ├── Issue121.java │ ├── Issue85.java │ ├── Issue130.java │ ├── Issue131.java │ ├── Issue124.java │ ├── Issue117.java │ ├── Issue126.java │ ├── Issue67.java │ ├── Issue101.java │ ├── Issue89.java │ ├── Issue99.java │ └── Issue115.java │ ├── property │ ├── SkipMeProperty.java │ ├── CannotParseProperty.java │ ├── ExceptionRuleTest.java │ └── ExceptionDatesTest.java │ ├── io │ ├── scribe │ │ └── property │ │ │ └── ScribeTest.java │ └── DefaultGlobalTimezoneIdResolverTest.java │ └── util │ └── IOUtilsTest.java ├── codecov.yml ├── .travis.yml ├── .github └── workflows │ └── maven.yml └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | /.classpath 2 | /.project 3 | /target/ 4 | /.settings/ 5 | -------------------------------------------------------------------------------- /docs/vcal-10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/vcal-10.pdf -------------------------------------------------------------------------------- /docs/rfc2445-ical.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/rfc2445-ical.pdf -------------------------------------------------------------------------------- /docs/rfc5545-ical.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/rfc5545-ical.pdf -------------------------------------------------------------------------------- /docs/rfc6321-xcal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/rfc6321-xcal.pdf -------------------------------------------------------------------------------- /docs/rfc7265-jcal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/rfc7265-jcal.pdf -------------------------------------------------------------------------------- /docs/rfc6868-circumflex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/rfc6868-circumflex.pdf -------------------------------------------------------------------------------- /src/main/java/biweekly/io/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains I/O related classes. 3 | */ 4 | package biweekly.io; -------------------------------------------------------------------------------- /src/main/java/biweekly/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains miscellaneous utility classes. 3 | */ 4 | package biweekly.util; -------------------------------------------------------------------------------- /docs/draft-ietf-calext-extensions-01.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/docs/draft-ietf-calext-extensions-01.pdf -------------------------------------------------------------------------------- /src/main/java/biweekly/property/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains DTO classes for each property. 3 | */ 4 | package biweekly.property; -------------------------------------------------------------------------------- /src/main/resources/biweekly/biweekly.properties: -------------------------------------------------------------------------------- 1 | version=${version} 2 | groupId=${groupId} 3 | artifactId=${artifactId} 4 | url=${url} 5 | -------------------------------------------------------------------------------- /src/main/java/biweekly/component/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains DTO classes for each component. 3 | */ 4 | package biweekly.component; -------------------------------------------------------------------------------- /src/test/resources/biweekly/util/base64.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mangstadt/biweekly/HEAD/src/test/resources/biweekly/util/base64.jpg -------------------------------------------------------------------------------- /src/main/java/biweekly/parameter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes related to property parameters. 3 | */ 4 | package biweekly.parameter; -------------------------------------------------------------------------------- /src/main/java/biweekly/io/chain/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes used in the chaining API. 3 | * @see biweekly.Biweekly 4 | */ 5 | package biweekly.io.chain; -------------------------------------------------------------------------------- /src/main/java/biweekly/io/json/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes for reading and writing jCals (JSON-encoded iCalendar objects). 3 | */ 4 | package biweekly.io.json; -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes that marshal and unmarshal components. 3 | */ 4 | package biweekly.io.scribe.component; -------------------------------------------------------------------------------- /src/main/java/biweekly/io/xml/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes for reading and writing xCals (XML-encoded iCalendar objects). 3 | */ 4 | package biweekly.io.xml; -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: 2 | layout: header, changes, diff 3 | coverage: 4 | ignore: 5 | - src/main/java/biweekly/util/org/.* 6 | status: 7 | patch: false 8 | precision: 0 -------------------------------------------------------------------------------- /src/main/java/biweekly/io/text/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes for reading and writing traditional, plain-text iCalendar objects. 3 | */ 4 | package biweekly.io.text; -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes that marshal and unmarshal components and properties in various formats. 3 | */ 4 | package biweekly.io.scribe; -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes that marshal and unmarshal properties in various formats. 3 | */ 4 | package biweekly.io.scribe.property; -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/vcal-example2.vcs: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:1.0 3 | BEGIN:VTODO 4 | SUMMARY:John to pay for lunch 5 | DUE:19960401T083000Z 6 | STATUS:NEEDS ACTION 7 | END:VTODO 8 | END:VCALENDAR 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: openjdk8 3 | 4 | #sudo must be set to "required" or else the build fails (see issue 92). 5 | #sudo: false #faster builds 6 | sudo: required 7 | 8 | script: "mvn cobertura:cobertura" 9 | after_success: 10 | - bash <(curl -s https://codecov.io/bash) 11 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/vcal-example1.vcs: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:1.0 3 | BEGIN:VEVENT 4 | CATEGORIES:MEETING 5 | STATUS:TENTATIVE 6 | DTSTART:19960401T033000Z 7 | DTEND:19960401T043000Z 8 | SUMMARY:Your Proposal Review 9 | DESCRIPTION:Steve and John to review newest proposal material 10 | CLASS:PRIVATE 11 | END:VEVENT 12 | END:VCALENDAR 13 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/vcal-example3.vcs: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:1.0 3 | BEGIN:VEVENT 4 | CATEGORIES:MEETING 5 | STATUS:NEEDS ACTION 6 | DTSTART:19960401T073000Z 7 | DTEND:19960401T083000Z 8 | SUMMARY:Steve's Proposal Review 9 | DESCRIPTION:Steve and John to review newest proposal material 10 | CLASS:PRIVATE 11 | END:VEVENT 12 | BEGIN:VTODO 13 | SUMMARY:John to pay for lunch 14 | DUE:19960401T083000Z 15 | STATUS:NEEDS ACTION 16 | END:VTODO 17 | END:VCALENDAR 18 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/rfc5545-example6.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//RDU Software//NONSGML HandCal//EN 4 | BEGIN:VFREEBUSY 5 | ORGANIZER:mailto:jsmith@example.com 6 | DTSTART:19980313T141711Z 7 | DTEND:19980410T141711Z 8 | FREEBUSY:19980314T233000Z/19980315T003000Z 9 | FREEBUSY:19980316T153000Z/19980316T163000Z 10 | FREEBUSY:19980318T030000Z/19980318T040000Z 11 | URL:http://www.example.com/calendar/busytime/jsmith.ifb 12 | END:VFREEBUSY 13 | END:VCALENDAR 14 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/issues/pr63.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | BEGIN:VEVENT 4 | DTSTART;TZID=/America/New_York:20161219T090000 5 | DTEND;TZID=/America/New_York:20161219T100000 6 | RRULE:FREQ=DAILY;UNTIL=20161223T140000Z 7 | DTSTAMP:20161216T153224Z 8 | UID:pdhtelaeqstgnbr9f0hrdioij0@google.com 9 | CREATED:20161216T133749Z 10 | DESCRIPTION: 11 | LAST-MODIFIED:20161216T133749Z 12 | LOCATION: 13 | SEQUENCE:0 14 | STATUS:CONFIRMED 15 | SUMMARY:Daily Until 12/23 16 | TRANSP:OPAQUE 17 | END:VEVENT 18 | END:VCALENDAR 19 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/rfc5545-example1.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//xyz Corp//NONSGML PDA Calendar Version 1.0//EN 4 | BEGIN:VEVENT 5 | DTSTAMP:19960704T120000Z 6 | UID:uid1@example.com 7 | ORGANIZER:mailto:jsmith@example.com 8 | DTSTART:19960918T143000Z 9 | DTEND:19960920T220000Z 10 | STATUS:CONFIRMED 11 | CATEGORIES:CONFERENCE 12 | SUMMARY:Networld+Interop Conference 13 | DESCRIPTION:Networld+Interop Conference 14 | and Exhibit\nAtlanta World Congress Center\n 15 | Atlanta\, Georgia 16 | END:VEVENT 17 | END:VCALENDAR 18 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/json/rfc7265-example1.json: -------------------------------------------------------------------------------- 1 | ["vcalendar", 2 | [ 3 | ["version", {}, "text", "2.0"], 4 | ["prodid", {}, "text", "-//Example Inc.//Example Calendar//EN"], 5 | ["calscale", {}, "text", "GREGORIAN"] 6 | ], 7 | [ 8 | ["vevent", 9 | [ 10 | ["dtstamp", {}, "date-time", "2008-02-05T19:12:24Z"], 11 | ["dtstart", {}, "date", "2008-10-06"], 12 | ["summary", {}, "text", "Planning meeting"], 13 | ["uid", {}, "text", "4088E990AD89CB3DBB484909"] 14 | ], 15 | [] 16 | ] 17 | ] 18 | ] -------------------------------------------------------------------------------- /src/test/resources/biweekly/issues/issue67.json: -------------------------------------------------------------------------------- 1 | ["vcalendar", 2 | [ 3 | ["version", {}, "text", "2.0"] 4 | ], 5 | [ 6 | ["vevent", 7 | [ 8 | ["summary", {}, "text", "Team Meeting"], 9 | ["description",{},"text","Some things describing this event"], 10 | ["dtstart", {"tzid": "/America/New_York"}, "date-time", "2017-03-22T12:00:00"], 11 | ["dtend",{"tzid": "/America/New_York"}, "date-time","2017-03-22T15:00:00"], 12 | ["rrule", {}, "recur", {"freq":"WEEKLY", "until":"2017-03-29T19:00:00Z", "wkst":"SU", "byday":["WE"]}] 13 | ], 14 | [] 15 | ] 16 | ] 17 | ] -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/rfc5545-example4.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//ABC Corporation//NONSGML My Product//EN 4 | BEGIN:VTODO 5 | DTSTAMP:19980130T134500Z 6 | SEQUENCE:2 7 | UID:uid4@example.com 8 | ORGANIZER:mailto:unclesam@example.com 9 | ATTENDEE;PARTSTAT=ACCEPTED:mailto:jqpublic@example.com 10 | DUE:19980415T000000 11 | STATUS:NEEDS-ACTION 12 | SUMMARY:Submit Income Taxes 13 | BEGIN:VALARM 14 | ACTION:AUDIO 15 | TRIGGER;VALUE=DATE-TIME:19980403T120000Z 16 | ATTACH;FMTTYPE=audio/basic:http://example.com/pub/audio- 17 | files/ssbanner.aud 18 | REPEAT:4 19 | DURATION:PT1H 20 | END:VALARM 21 | END:VTODO 22 | END:VCALENDAR 23 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 1.8 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 1.8 23 | - name: Build with Maven 24 | run: mvn -B package --file pom.xml 25 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/rfc5545-example3.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//ABC Corporation//NONSGML My Product//EN 4 | METHOD:xyz 5 | BEGIN:VEVENT 6 | DTSTAMP:19970324T120000Z 7 | SEQUENCE:0 8 | UID:uid3@example.com 9 | ORGANIZER:mailto:jdoe@example.com 10 | ATTENDEE;RSVP=TRUE:mailto:jsmith@example.com 11 | DTSTART:19970324T123000Z 12 | DTEND:19970324T210000Z 13 | CATEGORIES:MEETING,PROJECT 14 | CLASS:PUBLIC 15 | SUMMARY:Calendaring Interoperability Planning Meeting 16 | DESCRIPTION:Discuss how we can test c&s interoperability\n 17 | using iCalendar and other IETF standards. 18 | LOCATION:LDB Lobby 19 | ATTACH;FMTTYPE=application/postscript:ftp://example.com/pub/ 20 | conf/bkgrnd.ps 21 | END:VEVENT 22 | END:VCALENDAR 23 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/issues/issue126.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:Microsoft Exchange Server 2010 4 | METHOD:REQUEST 5 | BEGIN:VTIMEZONE 6 | TZID:W. Europe Standard Time 7 | BEGIN:STANDARD 8 | DTSTART:16010101T030000 9 | TZOFFSETFROM:+0200 10 | TZOFFSETTO:+0100 11 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 12 | END:STANDARD 13 | BEGIN:DAYLIGHT 14 | DTSTART:16010101T020000 15 | TZOFFSETFROM:+0100 16 | TZOFFSETTO:+0200 17 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3 18 | END:DAYLIGHT 19 | END:VTIMEZONE 20 | BEGIN:VEVENT 21 | DTSTART;TZID=W. Europe Standard Time:20231122T093000 22 | DTEND;TZID=W. Europe Standard Time:20231122T120000 23 | END:VEVENT 24 | BEGIN:VEVENT 25 | DTSTART;TZID=W. Europe Standard Time:20230422T093000 26 | DTEND;TZID=W. Europe Standard Time:20230422T120000 27 | END:VEVENT 28 | END:VCALENDAR 29 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/issues/issue85.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN 3 | VERSION:2.0 4 | BEGIN:VTIMEZONE 5 | TZID:W. Europe Standard Time 6 | BEGIN:STANDARD 7 | DTSTART:16011028T030000 8 | RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 9 | TZOFFSETFROM:+0200 10 | TZOFFSETTO:+0100 11 | END:STANDARD 12 | BEGIN:DAYLIGHT 13 | DTSTART:16010325T020000 14 | RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 15 | TZOFFSETFROM:+0100 16 | TZOFFSETTO:+0200 17 | END:DAYLIGHT 18 | END:VTIMEZONE 19 | BEGIN:VEVENT 20 | CLASS:PUBLIC 21 | CREATED:20180314T152639Z 22 | DESCRIPTION: Test 23 | DTEND;TZID="W. Europe Standard Time":20180722T130000 24 | DTSTAMP:20180314T152639Z 25 | DTSTART;TZID="W. Europe Standard Time":20180722T120000 26 | SUMMARY;LANGUAGE=de:Meeting in Berlin 27 | UID:0a1f4b32-279a-11e8-adab-e67eecc63901 28 | END:VEVENT 29 | END:VCALENDAR 30 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/issues/issue85-1980.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN 3 | VERSION:2.0 4 | BEGIN:VTIMEZONE 5 | TZID:W. Europe Standard Time 6 | BEGIN:STANDARD 7 | DTSTART:16011028T030000 8 | RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 9 | TZOFFSETFROM:+0200 10 | TZOFFSETTO:+0100 11 | END:STANDARD 12 | BEGIN:DAYLIGHT 13 | DTSTART:19800101T000000 14 | RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 15 | TZOFFSETFROM:+0100 16 | TZOFFSETTO:+0200 17 | END:DAYLIGHT 18 | END:VTIMEZONE 19 | BEGIN:VEVENT 20 | CLASS:PUBLIC 21 | CREATED:20180314T152639Z 22 | DESCRIPTION: Test 23 | DTEND;TZID="W. Europe Standard Time":20180722T130000 24 | DTSTAMP:20180314T152639Z 25 | DTSTART;TZID="W. Europe Standard Time":20180722T120000 26 | SUMMARY;LANGUAGE=de:Meeting in Berlin 27 | UID:0a1f4b32-279a-11e8-adab-e67eecc63901 28 | END:VEVENT 29 | END:VCALENDAR 30 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/xml/rfc6321-example1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GREGORIAN 7 | 8 | 9 | -//Example Inc.//Example Calendar//EN 10 | 11 | 12 | 2.0 13 | 14 | 15 | 16 | 17 | 18 | 19 | 2008-02-05T19:12:24Z 20 | 21 | 22 | 2008-10-06 23 | 24 | 25 | Planning meeting 26 | 27 | 28 | 4088E990AD89CB3DBB484909 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/rfc5545-example2.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//RDU Software//NONSGML HandCal//EN 4 | BEGIN:VTIMEZONE 5 | TZID:America/New_York 6 | BEGIN:STANDARD 7 | DTSTART:19981025T020000 8 | TZOFFSETFROM:-0400 9 | TZOFFSETTO:-0500 10 | TZNAME:EST 11 | END:STANDARD 12 | BEGIN:DAYLIGHT 13 | DTSTART:19990404T020000 14 | TZOFFSETFROM:-0500 15 | TZOFFSETTO:-0400 16 | TZNAME:EDT 17 | END:DAYLIGHT 18 | END:VTIMEZONE 19 | BEGIN:VEVENT 20 | DTSTAMP:19980309T231000Z 21 | UID:guid-1.example.com 22 | ORGANIZER:mailto:mrbig@example.com 23 | ATTENDEE;CUTYPE=GROUP;RSVP=TRUE;ROLE=REQ-PARTICIPANT: 24 | mailto:employee-A@example.com 25 | DESCRIPTION:Project XYZ Review Meeting 26 | CATEGORIES:MEETING 27 | CLASS:PUBLIC 28 | CREATED:19980309T130000Z 29 | SUMMARY:XYZ Project Review 30 | DTSTART;TZID=America/New_York:19980312T083000 31 | DTEND;TZID=America/New_York:19980312T093000 32 | LOCATION:1CP Conference Room 4350 33 | END:VEVENT 34 | END:VCALENDAR 35 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/rfc5545-example5.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//ABC Corporation//NONSGML My Product//EN 4 | BEGIN:VJOURNAL 5 | DTSTAMP:19970324T120000Z 6 | UID:uid5@example.com 7 | ORGANIZER:mailto:jsmith@example.com 8 | STATUS:DRAFT 9 | CLASS:PUBLIC 10 | CATEGORIES:Project Report,XYZ,Weekly Meeting 11 | DESCRIPTION:Project xyz Review Meeting Minutes\n 12 | Agenda\n1. Review of project version 1.0 requirements.\n2. 13 | Definition 14 | of project processes.\n3. Review of project schedule.\n 15 | Participants: John Smith\, Jane Doe\, Jim Dandy\n-It was 16 | decided that the requirements need to be signed off by 17 | product marketing.\n-Project processes were accepted.\n 18 | -Project schedule needs to account for scheduled holidays 19 | and employee vacation time. Check with HR for specific 20 | dates.\n-New schedule will be distributed by Friday.\n- 21 | Next weeks meeting is cancelled. No meeting until 3/23. 22 | END:VJOURNAL 23 | END:VCALENDAR 24 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue121.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.TimeZone; 6 | 7 | import org.junit.Test; 8 | 9 | import biweekly.Biweekly; 10 | import biweekly.ICalendar; 11 | 12 | /** 13 | * @author Michael Angstadt 14 | * @see "https://github.com/mangstadt/biweekly/issues/121" 15 | */ 16 | public class Issue121 { 17 | @Test 18 | public void test() throws Exception { 19 | //@formatter:off 20 | String input = 21 | "BEGIN:VCALENDAR\n" + 22 | "VERSION:2.0\n" + 23 | "BEGIN:VEVENT\n" + 24 | "RRULE:FREQ=WEEKLY;INTERVAL=1;BYMONTH=96\n" + 25 | "DTSTART:20209621T090000Z\n" + //invalid month value: 96 26 | "DTEND:20209621T100000Z\n" + //invalid month value: 96 27 | "END:VEVENT\n" + 28 | "END:VCALENDAR\n"; 29 | //@formatter:on 30 | 31 | ICalendar ical = Biweekly.parse(input).first(); 32 | try { 33 | ical.getEvents().get(0).getDateIterator(TimeZone.getDefault()); 34 | } catch (AssertionError e) { 35 | assertEquals("96", e.getMessage()); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue85.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.text.DateFormat; 6 | import java.text.SimpleDateFormat; 7 | import java.util.TimeZone; 8 | 9 | import org.junit.Test; 10 | 11 | import biweekly.Biweekly; 12 | import biweekly.ICalendar; 13 | import biweekly.component.VEvent; 14 | 15 | /** 16 | * @author Michael Angstadt 17 | * @see "https://github.com/mangstadt/biweekly/issues/85" 18 | */ 19 | public class Issue85 { 20 | @Test 21 | public void test() throws Exception { 22 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); 23 | df.setTimeZone(TimeZone.getTimeZone("UTC")); 24 | 25 | String files[] = { "issue85.ics", "issue85-1980.ics" }; 26 | for (String file : files) { 27 | ICalendar ical = Biweekly.parse(Issue85.class.getResourceAsStream(file)).first(); 28 | VEvent event = ical.getEvents().get(0); 29 | 30 | assertEquals("2018-07-22T10:00:00", df.format(event.getDateStart().getValue())); 31 | assertEquals("2018-07-22T11:00:00", df.format(event.getDateEnd().getValue())); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue130.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static biweekly.util.TestUtils.date; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | import java.util.Date; 7 | import java.util.TimeZone; 8 | 9 | import org.junit.Ignore; 10 | import org.junit.Rule; 11 | import org.junit.Test; 12 | 13 | import biweekly.component.VEvent; 14 | import biweekly.util.DefaultTimezoneRule; 15 | import biweekly.util.Frequency; 16 | import biweekly.util.Recurrence; 17 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 18 | 19 | /** 20 | * @author Michael Angstadt 21 | * @see "https://github.com/mangstadt/biweekly/issues/130" 22 | */ 23 | public class Issue130 { 24 | @Rule 25 | public final DefaultTimezoneRule rule = new DefaultTimezoneRule("America/Chicago"); 26 | 27 | @Test 28 | @Ignore 29 | public void test() throws Exception { 30 | Date start = date(2024, 1, 1, 0, 0, 0); 31 | Recurrence rrule = new Recurrence.Builder(Frequency.HOURLY).build(); 32 | 33 | VEvent event = new VEvent(); 34 | event.setDateStart(start); 35 | event.setRecurrenceRule(rrule); 36 | 37 | DateIterator it = event.getDateIterator(TimeZone.getDefault()); 38 | it.advanceTo(date(2024, 1, 31, 18, 0, 0)); 39 | 40 | Date actual = it.next(); //actual: "2024-02-01 00:00" 41 | Date expected = date(2024, 1, 31, 19, 0, 0); 42 | assertEquals(expected, actual); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue131.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static biweekly.util.TestUtils.date; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | import java.util.Date; 7 | import java.util.TimeZone; 8 | 9 | import org.junit.Ignore; 10 | import org.junit.Rule; 11 | import org.junit.Test; 12 | 13 | import biweekly.component.VEvent; 14 | import biweekly.util.DefaultTimezoneRule; 15 | import biweekly.util.Frequency; 16 | import biweekly.util.Recurrence; 17 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 18 | 19 | /** 20 | * @author Michael Angstadt 21 | * @see "https://github.com/mangstadt/biweekly/issues/131" 22 | */ 23 | public class Issue131 { 24 | @Rule 25 | public final DefaultTimezoneRule rule = new DefaultTimezoneRule("America/Chicago"); 26 | 27 | @Test 28 | @Ignore 29 | public void test() throws Exception { 30 | Date start = date(2024, 1, 1, 0, 0, 0); 31 | Recurrence rrule = new Recurrence.Builder(Frequency.HOURLY).build(); 32 | 33 | VEvent event = new VEvent(); 34 | event.setDateStart(start); 35 | event.setRecurrenceRule(rrule); 36 | 37 | DateIterator it = event.getDateIterator(TimeZone.getDefault()); 38 | it.advanceTo(date(2024, 1, 31, 18, 0, 0)); 39 | 40 | Date actual = it.next(); //actual: "2024-02-01 00:00" 41 | Date expected = date(2024, 1, 31, 19, 0, 0); 42 | assertEquals(expected, actual); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2024, Michael Angstadt 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /src/main/resources/biweekly/biweekly.license: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2024, Michael Angstadt 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/issues/issue101.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | PRODID:-//K Desktop Environment//NONSGML libkcal 4.3//EN 3 | VERSION:2.0 4 | X-KDE-ICAL-IMPLEMENTATION-VERSION:1.0 5 | BEGIN:VTIMEZONE 6 | TZID:Europe/Berlin 7 | BEGIN:STANDARD 8 | TZNAME:CET 9 | TZOFFSETFROM:+0000 10 | TZOFFSETTO:+0100 11 | DTSTART:19791231T230000 12 | RDATE:19791231T230000 13 | END:STANDARD 14 | BEGIN:DAYLIGHT 15 | TZNAME:CEST 16 | TZOFFSETFROM:+0100 17 | TZOFFSETTO:+0200 18 | DTSTART:19810329T020000 19 | RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 20 | END:DAYLIGHT 21 | BEGIN:DAYLIGHT 22 | TZNAME:CEST 23 | TZOFFSETFROM:+0100 24 | TZOFFSETTO:+0200 25 | DTSTART:19800406T020000 26 | RDATE:19800406T020000 27 | END:DAYLIGHT 28 | BEGIN:STANDARD 29 | TZNAME:CET 30 | TZOFFSETFROM:+0200 31 | TZOFFSETTO:+0100 32 | DTSTART:19971026T030000 33 | RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 34 | END:STANDARD 35 | BEGIN:STANDARD 36 | TZNAME:CET 37 | TZOFFSETFROM:+0200 38 | TZOFFSETTO:+0100 39 | DTSTART:19800928T030000 40 | RRULE:FREQ=YEARLY;UNTIL=19961027T030000;BYDAY=-1SU;BYMONTH=9 41 | RDATE:19950924T030000 42 | END:STANDARD 43 | END:VTIMEZONE 44 | BEGIN:VEVENT 45 | DTSTAMP:20201003T144319Z 46 | CREATED:20201003T144243Z 47 | UID:37c5678e-ab6e-4616-a11b-0ce7e8dcd3c6 48 | LAST-MODIFIED:20201003T144319Z 49 | SUMMARY:Repeating 50 | RRULE:FREQ=DAILY;UNTIL=20201010T145800Z 51 | DTSTART;TZID=Europe/Berlin:20201004T170000 52 | DTEND;TZID=Europe/Berlin:20201004T180000 53 | TRANSP:OPAQUE 54 | END:VEVENT 55 | END:VCALENDAR 56 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue124.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNull; 5 | 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import org.junit.Test; 12 | 13 | import biweekly.ICalVersion; 14 | import biweekly.io.ParseContext; 15 | import biweekly.io.scribe.property.RecurrenceRuleScribe; 16 | import biweekly.parameter.ICalParameters; 17 | import biweekly.property.RecurrenceRule; 18 | import biweekly.util.Recurrence; 19 | 20 | /** 21 | * @author Michael Angstadt 22 | * @see "https://github.com/mangstadt/biweekly/issues/124" 23 | */ 24 | public class Issue124 { 25 | @Test 26 | public void test() throws Exception { 27 | String input = "INVALID"; 28 | Recurrence recur = parseRecurrence(input); 29 | 30 | Map> expectedXRules = new HashMap>(); 31 | List values = new ArrayList(); 32 | values.add(""); 33 | expectedXRules.put(input, values); 34 | 35 | assertNull(recur.getFrequency()); 36 | assertEquals(expectedXRules, recur.getXRules()); 37 | } 38 | 39 | private Recurrence parseRecurrence(String input) { 40 | RecurrenceRuleScribe scribe = new RecurrenceRuleScribe(); 41 | ParseContext context = new ParseContext(); 42 | context.setVersion(ICalVersion.V2_0); 43 | RecurrenceRule rrule = scribe.parseText(input, null, new ICalParameters(), context); 44 | return rrule.getValue(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue117.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.Date; 6 | import java.util.TimeZone; 7 | 8 | import org.junit.Test; 9 | 10 | import biweekly.Biweekly; 11 | import biweekly.ICalendar; 12 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 13 | 14 | /** 15 | * @author Michael Angstadt 16 | * @see "https://github.com/mangstadt/biweekly/issues/117" 17 | */ 18 | public class Issue117 { 19 | @Test 20 | public void test() { 21 | ICalendar ical1 = ical("RRULE:FREQ=WEEKLY;INTERVAL=1;WKST=SU;BYDAY=TH,FR"); 22 | ICalendar ical2 = ical("RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;WKST=SU"); 23 | 24 | TimeZone tz = TimeZone.getDefault(); 25 | DateIterator it1 = ical1.getEvents().get(0).getDateIterator(tz); 26 | DateIterator it2 = ical2.getEvents().get(0).getDateIterator(tz); 27 | 28 | for (int i = 0; i < 20; i++) { 29 | Date d1 = it1.next(); 30 | Date d2 = it2.next(); 31 | assertEquals(d1, d2); 32 | System.out.println(d1); 33 | } 34 | } 35 | 36 | private ICalendar ical(String rruleString) { 37 | //@formatter:off 38 | String str = 39 | "BEGIN:VCALENDAR\r\n" + 40 | "VERSION:2.0\r\n" + 41 | "PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN\r\n" + 42 | "BEGIN:VEVENT\r\n" + 43 | "DTSTART:20220606T110000Z\r\n" + 44 | rruleString + "\r\n" + 45 | "END:VEVENT\r\n" + 46 | "END:VCALENDAR\r\n"; 47 | //@formatter:on 48 | 49 | return Biweekly.parse(str).first(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue126.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static biweekly.util.TestUtils.date; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | import java.util.Date; 7 | 8 | import org.junit.Test; 9 | 10 | import biweekly.Biweekly; 11 | import biweekly.ICalendar; 12 | import biweekly.component.VEvent; 13 | 14 | /** 15 | * @author Michael Angstadt 16 | * @see "https://github.com/mangstadt/biweekly/issues/126" 17 | */ 18 | public class Issue126 { 19 | @Test 20 | public void test() throws Exception { 21 | ICalendar ical = Biweekly.parse(getClass().getResourceAsStream("issue126.ics")).first(); 22 | 23 | /* 24 | * The first event comes after the last Sunday in October, so it should 25 | * be in standard time (offset of +01:00). 26 | */ 27 | { 28 | VEvent event = ical.getEvents().get(0); 29 | 30 | Date expected = date(2023, 11, 22, 9, 30, 0, "+0100"); 31 | Date actual = event.getDateStart().getValue(); 32 | assertEquals(expected, actual); 33 | 34 | expected = date(2023, 11, 22, 12, 0, 0, "+0100"); 35 | actual = event.getDateEnd().getValue(); 36 | assertEquals(expected, actual); 37 | } 38 | 39 | /* 40 | * The second event comes after the last Sunday in March, so it should 41 | * be in daylight time (offset of +02:00). 42 | */ 43 | { 44 | VEvent event = ical.getEvents().get(1); 45 | 46 | Date expected = date(2023, 4, 22, 9, 30, 0, "+0200"); 47 | Date actual = event.getDateStart().getValue(); 48 | assertEquals(expected, actual); 49 | 50 | expected = date(2023, 4, 22, 12, 0, 0, "+0200"); 51 | actual = event.getDateEnd().getValue(); 52 | assertEquals(expected, actual); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue67.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.text.DateFormat; 6 | import java.text.SimpleDateFormat; 7 | import java.util.ArrayList; 8 | import java.util.Arrays; 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.TimeZone; 12 | 13 | import org.junit.Test; 14 | 15 | import biweekly.Biweekly; 16 | import biweekly.ICalendar; 17 | import biweekly.component.VEvent; 18 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 19 | 20 | /** 21 | * @author Michael Angstadt 22 | * @see "https://github.com/mangstadt/biweekly/issues/67" 23 | */ 24 | public class Issue67 { 25 | /* 26 | * These tests failed for user Dupplicate under the default timezone "CET" 27 | * RRuleIteratorImplTest#dailyUntilDec4 28 | * RRuleIteratorImplTest#advanceTo 29 | */ 30 | 31 | @Test 32 | public void carolinelane10() throws Exception { 33 | ICalendar ical = Biweekly.parseJson(Issue67.class.getResourceAsStream("issue67.json")).first(); 34 | VEvent vEvent = ical.getEvents().get(0); 35 | 36 | TimeZone eventTimezone = TimeZone.getTimeZone("America/New_York"); 37 | DateIterator iterator = vEvent.getDateIterator(eventTimezone); 38 | 39 | List actual = new ArrayList(); 40 | while (iterator.hasNext()) { 41 | Date startDate = iterator.next(); 42 | actual.add(startDate); 43 | } 44 | 45 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); 46 | df.setTimeZone(eventTimezone); 47 | 48 | List expected = Arrays.asList( //@formatter:off 49 | df.parse("2017-03-22T12:00:00"), 50 | df.parse("2017-03-29T12:00:00") 51 | ); //@formatter:on 52 | 53 | assertEquals(expected, actual); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue101.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import biweekly.Biweekly; 4 | import biweekly.ICalendar; 5 | import biweekly.component.VEvent; 6 | import biweekly.util.DefaultTimezoneRule; 7 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 8 | import org.junit.Rule; 9 | import org.junit.Test; 10 | 11 | import java.text.DateFormat; 12 | import java.text.SimpleDateFormat; 13 | import java.util.ArrayList; 14 | import java.util.Arrays; 15 | import java.util.Date; 16 | import java.util.List; 17 | import java.util.TimeZone; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | 21 | /** 22 | * @author Michael Angstadt 23 | * @see "https://github.com/mangstadt/biweekly/issues/101" 24 | */ 25 | public class Issue101 { 26 | @Rule 27 | public final DefaultTimezoneRule defaultTimezoneRule = new DefaultTimezoneRule("CET"); 28 | 29 | @Test 30 | public void test() throws Exception { 31 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); 32 | ICalendar calendar = Biweekly.parse(getClass().getResourceAsStream("issue101.ics")).first(); 33 | 34 | List actual = new ArrayList(); 35 | for (VEvent evt: calendar.getEvents()) { 36 | DateIterator it = evt.getDateIterator(TimeZone.getDefault()); 37 | while (it.hasNext()) { 38 | Date current = it.next(); 39 | actual.add(current); 40 | } 41 | } 42 | 43 | List expected = Arrays.asList( //@formatter:off 44 | df.parse("2020-10-04T17:00:00"), 45 | df.parse("2020-10-05T17:00:00"), 46 | df.parse("2020-10-06T17:00:00"), 47 | df.parse("2020-10-07T17:00:00"), 48 | df.parse("2020-10-08T17:00:00"), 49 | df.parse("2020-10-09T17:00:00") 50 | ); //@formatter:on 51 | 52 | assertEquals(expected, actual); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/java/biweekly/property/SkipMeProperty.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import biweekly.io.scribe.property.SkipMeScribe; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Used with the {@link SkipMeScribe} scribe. 32 | * @author Michael Angstadt 33 | */ 34 | public class SkipMeProperty extends ICalProperty { 35 | //empty 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/biweekly/util/Frequency.java: -------------------------------------------------------------------------------- 1 | package biweekly.util; 2 | 3 | /* 4 | Copyright (c) 2013-2024, Michael Angstadt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /** 29 | * Represents the frequency at which a recurrence rule repeats itself. 30 | * @author Michael Angstadt 31 | */ 32 | public enum Frequency { 33 | //in order of increasing length 34 | SECONDLY, MINUTELY, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/biweekly/property/CannotParseProperty.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import biweekly.io.scribe.property.CannotParseScribe; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Used with the {@link CannotParseScribe} scribe. 32 | * @author Michael Angstadt 33 | */ 34 | public class CannotParseProperty extends ICalProperty { 35 | //empty 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue89.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.text.DateFormat; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | import java.util.TimeZone; 9 | 10 | import org.junit.Test; 11 | 12 | import biweekly.ICalVersion; 13 | import biweekly.io.ParseContext; 14 | import biweekly.io.scribe.property.RecurrenceRuleScribe; 15 | import biweekly.parameter.ICalParameters; 16 | import biweekly.property.RecurrenceRule; 17 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 18 | 19 | /** 20 | * @author Michael Angstadt 21 | * @see "https://github.com/mangstadt/biweekly/issues/89" 22 | */ 23 | public class Issue89 { 24 | @Test 25 | public void givenRRULE_whenAdvanceTo_ensureNextIsNextOccurrence() throws Exception { 26 | TimeZone utc = TimeZone.getTimeZone("UTC"); 27 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); 28 | df.setTimeZone(utc); 29 | 30 | // given 31 | final String rrule = "FREQ=MONTHLY;BYSETPOS=3;BYDAY=MO"; // every 3rd Monday of the month 32 | final Date startDate = df.parse("2019-01-01T00:00:00"); // starting in 2019 33 | 34 | // when 35 | RecurrenceRuleScribe scribe = new RecurrenceRuleScribe(); 36 | ParseContext context = new ParseContext(); 37 | context.setVersion(ICalVersion.V2_0); 38 | RecurrenceRule recurrenceRule = scribe.parseText(rrule, null, new ICalParameters(), context); 39 | DateIterator iter = recurrenceRule.getDateIterator(startDate, utc); 40 | 41 | Date evalDate = df.parse("2019-08-01T00:00:00"); 42 | iter.advanceTo(evalDate); 43 | Date nextOccurrence = iter.next(); 44 | 45 | // ensure 46 | assertEquals(df.parse("2019-08-19T00:00:00Z"), nextOccurrence); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue99.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.text.DateFormat; 6 | import java.text.SimpleDateFormat; 7 | import java.util.ArrayList; 8 | import java.util.Arrays; 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.TimeZone; 12 | 13 | import org.junit.Test; 14 | 15 | import biweekly.component.VEvent; 16 | import biweekly.util.Frequency; 17 | import biweekly.util.Recurrence; 18 | import biweekly.util.com.google.ical.compat.javautil.DateIterator; 19 | 20 | /** 21 | * @author Michael Angstadt 22 | * @see "https://github.com/mangstadt/biweekly/issues/99" 23 | */ 24 | public class Issue99 { 25 | @Test 26 | public void issue99() throws Exception { 27 | TimeZone timezone = TimeZone.getTimeZone("America/New_York"); 28 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); 29 | df.setTimeZone(timezone); 30 | 31 | VEvent event = new VEvent(); 32 | 33 | Date start = df.parse("2020-03-01T12:00:00"); 34 | event.setDateStart(start); 35 | 36 | Date until = df.parse("2020-03-05T12:01:00"); 37 | Recurrence recur = new Recurrence.Builder(Frequency.DAILY).until(until).build(); 38 | event.setRecurrenceRule(recur); 39 | 40 | List actual = new ArrayList(); 41 | DateIterator iterator = event.getDateIterator(timezone); 42 | while (iterator.hasNext()) { 43 | Date date = iterator.next(); 44 | actual.add(date); 45 | } 46 | 47 | List expected = Arrays.asList( //@formatter:off 48 | df.parse("2020-03-01T12:00:00"), 49 | df.parse("2020-03-02T12:00:00"), 50 | df.parse("2020-03-03T12:00:00"), 51 | df.parse("2020-03-04T12:00:00"), 52 | df.parse("2020-03-05T12:00:00") 53 | ); //@formatter:on 54 | 55 | assertEquals(expected, actual); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/biweekly/issues/Issue115.java: -------------------------------------------------------------------------------- 1 | package biweekly.issues; 2 | 3 | import static biweekly.util.TestUtils.date; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | import java.util.Date; 7 | 8 | import org.junit.Test; 9 | 10 | import biweekly.Biweekly; 11 | import biweekly.ICalendar; 12 | import biweekly.component.VEvent; 13 | 14 | /** 15 | * @author Michael Angstadt 16 | * @see "https://github.com/mangstadt/biweekly/issues/115" 17 | */ 18 | public class Issue115 { 19 | @Test 20 | public void test1() throws Exception { 21 | ICalendar ical = Biweekly.parse(getClass().getResourceAsStream("issue115-1.ics")).first(); 22 | 23 | /* 24 | * The event comes before the last Sunday in October, so it should 25 | * be in daylight time (offset of +02:00). 26 | */ 27 | VEvent event = ical.getEvents().get(0); 28 | 29 | Date expected = date(2022, 10, 29, 8, 0, 0, "+0200"); 30 | Date actual = event.getDateStart().getValue(); 31 | assertEquals(expected, actual); 32 | 33 | expected = date(2022, 10, 29, 8, 30, 0, "+0200"); 34 | actual = event.getDateEnd().getValue(); 35 | assertEquals(expected, actual); 36 | } 37 | 38 | @Test 39 | public void test2() throws Exception { 40 | ICalendar ical = Biweekly.parse(getClass().getResourceAsStream("issue115-2.ics")).first(); 41 | 42 | /* 43 | * The event comes after the last Sunday in October, so it should 44 | * be in standard time (offset of +01:00). 45 | */ 46 | VEvent event = ical.getEvents().get(0); 47 | 48 | Date expected = date(2022, 10, 31, 8, 0, 0, "+0100"); 49 | System.out.println(expected); 50 | Date actual = event.getDateStart().getValue(); 51 | assertEquals(expected, actual); 52 | 53 | expected = date(2022, 10, 31, 8, 30, 0, "+0100"); 54 | actual = event.getDateEnd().getValue(); 55 | assertEquals(expected, actual); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/VTodoScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import biweekly.component.VTodo; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * @author Michael Angstadt 32 | */ 33 | public class VTodoScribe extends ICalComponentScribe { 34 | public VTodoScribe() { 35 | super(VTodo.class, "VTODO"); 36 | } 37 | 38 | @Override 39 | protected VTodo _newInstance() { 40 | return new VTodo(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/VEventScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import biweekly.component.VEvent; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * @author Michael Angstadt 32 | */ 33 | public class VEventScribe extends ICalComponentScribe { 34 | public VEventScribe() { 35 | super(VEvent.class, "VEVENT"); 36 | } 37 | 38 | @Override 39 | protected VEvent _newInstance() { 40 | return new VEvent(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/StandardTimeScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import biweekly.component.StandardTime; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * @author Michael Angstadt 32 | */ 33 | public class StandardTimeScribe extends ObservanceScribe { 34 | public StandardTimeScribe() { 35 | super(StandardTime.class, "STANDARD"); 36 | } 37 | 38 | @Override 39 | protected StandardTime _newInstance() { 40 | return new StandardTime(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/PriorityScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.property.Priority; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Marshals {@link Priority} properties. 32 | * @author Michael Angstadt 33 | */ 34 | public class PriorityScribe extends IntegerPropertyScribe { 35 | public PriorityScribe() { 36 | super(Priority.class, "PRIORITY"); 37 | } 38 | 39 | @Override 40 | protected Priority newInstance(Integer value) { 41 | return new Priority(value); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/SequenceScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.property.Sequence; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Marshals {@link Sequence} properties. 32 | * @author Michael Angstadt 33 | */ 34 | public class SequenceScribe extends IntegerPropertyScribe { 35 | public SequenceScribe() { 36 | super(Sequence.class, "SEQUENCE"); 37 | } 38 | 39 | @Override 40 | protected Sequence newInstance(Integer value) { 41 | return new Sequence(value); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/UidScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Uid; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Uid} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class UidScribe extends TextPropertyScribe { 36 | public UidScribe() { 37 | super(Uid.class, "UID"); 38 | } 39 | 40 | @Override 41 | protected Uid newInstance(String value, ICalVersion version) { 42 | return new Uid(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/NameScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Name; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Name} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class NameScribe extends TextPropertyScribe { 36 | public NameScribe() { 37 | super(Name.class, "NAME"); 38 | } 39 | 40 | @Override 41 | protected Name newInstance(String value, ICalVersion version) { 42 | return new Name(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ColorScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Color; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Color} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class ColorScribe extends TextPropertyScribe { 36 | public ColorScribe() { 37 | super(Color.class, "COLOR"); 38 | } 39 | 40 | @Override 41 | protected Color newInstance(String value, ICalVersion version) { 42 | return new Color(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/DaylightSavingsTimeScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import biweekly.component.DaylightSavingsTime; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * @author Michael Angstadt 32 | */ 33 | public class DaylightSavingsTimeScribe extends ObservanceScribe { 34 | public DaylightSavingsTimeScribe() { 35 | super(DaylightSavingsTime.class, "DAYLIGHT"); 36 | } 37 | 38 | @Override 39 | protected DaylightSavingsTime _newInstance() { 40 | return new DaylightSavingsTime(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/DateDueScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.property.DateDue; 4 | import biweekly.util.ICalDate; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link DateDue} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class DateDueScribe extends DateOrDateTimePropertyScribe { 36 | public DateDueScribe() { 37 | super(DateDue.class, "DUE"); 38 | } 39 | 40 | @Override 41 | protected DateDue newInstance(ICalDate date) { 42 | return new DateDue(date); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/DateEndScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.property.DateEnd; 4 | import biweekly.util.ICalDate; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link DateEnd} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class DateEndScribe extends DateOrDateTimePropertyScribe { 36 | public DateEndScribe() { 37 | super(DateEnd.class, "DTEND"); 38 | } 39 | 40 | @Override 41 | protected DateEnd newInstance(ICalDate date) { 42 | return new DateEnd(date); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/SummaryScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Summary; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Summary} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class SummaryScribe extends TextPropertyScribe { 36 | public SummaryScribe() { 37 | super(Summary.class, "SUMMARY"); 38 | } 39 | 40 | @Override 41 | protected Summary newInstance(String value, ICalVersion version) { 42 | return new Summary(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/LocationScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Location; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Location} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class LocationScribe extends TextPropertyScribe { 36 | public LocationScribe() { 37 | super(Location.class, "LOCATION"); 38 | } 39 | 40 | @Override 41 | protected Location newInstance(String value, ICalVersion version) { 42 | return new Location(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/CompletedScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.Date; 4 | 5 | import biweekly.property.Completed; 6 | 7 | 8 | /* 9 | Copyright (c) 2013-2024, Michael Angstadt 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /** 34 | * Marshals {@link Completed} properties. 35 | * @author Michael Angstadt 36 | */ 37 | public class CompletedScribe extends DateTimePropertyScribe { 38 | public CompletedScribe() { 39 | super(Completed.class, "COMPLETED"); 40 | } 41 | 42 | @Override 43 | protected Completed newInstance(Date date) { 44 | return new Completed(date); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/UrlScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalDataType; 4 | import biweekly.ICalVersion; 5 | import biweekly.property.Url; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * Marshals {@link Url} properties. 34 | * @author Michael Angstadt 35 | */ 36 | public class UrlScribe extends TextPropertyScribe { 37 | public UrlScribe() { 38 | super(Url.class, "URL", ICalDataType.URI); 39 | } 40 | 41 | @Override 42 | protected Url newInstance(String value, ICalVersion version) { 43 | return new Url(value); 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ProductIdScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.ProductId; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link ProductId} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class ProductIdScribe extends TextPropertyScribe { 36 | public ProductIdScribe() { 37 | super(ProductId.class, "PRODID"); 38 | } 39 | 40 | @Override 41 | protected ProductId newInstance(String value, ICalVersion version) { 42 | return new ProductId(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/RelatedToScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.RelatedTo; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link RelatedTo} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class RelatedToScribe extends TextPropertyScribe { 36 | public RelatedToScribe() { 37 | super(RelatedTo.class, "RELATED-TO"); 38 | } 39 | 40 | @Override 41 | protected RelatedTo newInstance(String value, ICalVersion version) { 42 | return new RelatedTo(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/DescriptionScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Description; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Description} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class DescriptionScribe extends TextPropertyScribe { 36 | public DescriptionScribe() { 37 | super(Description.class, "DESCRIPTION"); 38 | } 39 | 40 | @Override 41 | protected Description newInstance(String value, ICalVersion version) { 42 | return new Description(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/LastModifiedScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.Date; 4 | 5 | import biweekly.property.LastModified; 6 | 7 | 8 | /* 9 | Copyright (c) 2013-2024, Michael Angstadt 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /** 34 | * Marshals {@link LastModified} properties. 35 | * @author Michael Angstadt 36 | */ 37 | public class LastModifiedScribe extends DateTimePropertyScribe { 38 | public LastModifiedScribe() { 39 | super(LastModified.class, "LAST-MODIFIED"); 40 | } 41 | 42 | @Override 43 | protected LastModified newInstance(Date date) { 44 | return new LastModified(date); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/SourceScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalDataType; 4 | import biweekly.ICalVersion; 5 | import biweekly.property.Source; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * Marshals {@link Source} properties. 34 | * @author Michael Angstadt 35 | */ 36 | public class SourceScribe extends TextPropertyScribe { 37 | public SourceScribe() { 38 | super(Source.class, "SOURCE", ICalDataType.URI); 39 | } 40 | 41 | @Override 42 | protected Source newInstance(String value, ICalVersion version) { 43 | return new Source(value); 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/property/UtcOffsetProperty.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import biweekly.util.UtcOffset; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Represents a property whose value is a timezone offset. 32 | * @author Michael Angstadt 33 | */ 34 | public class UtcOffsetProperty extends ValuedProperty { 35 | public UtcOffsetProperty(UtcOffset offset) { 36 | super(offset); 37 | } 38 | 39 | /** 40 | * Copy constructor. 41 | * @param original the property to make a copy of 42 | */ 43 | public UtcOffsetProperty(UtcOffsetProperty original) { 44 | super(original); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ExceptionRuleScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.property.ExceptionRule; 4 | import biweekly.util.Recurrence; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link ExceptionRule} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class ExceptionRuleScribe extends RecurrencePropertyScribe { 36 | public ExceptionRuleScribe() { 37 | super(ExceptionRule.class, "EXRULE"); 38 | } 39 | 40 | @Override 41 | protected ExceptionRule newInstance(Recurrence recur) { 42 | return new ExceptionRule(recur); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ClassificationScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.property.Classification; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Classification} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class ClassificationScribe extends TextPropertyScribe { 36 | public ClassificationScribe() { 37 | super(Classification.class, "CLASS"); 38 | } 39 | 40 | @Override 41 | protected Classification newInstance(String value, ICalVersion version) { 42 | return new Classification(value); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/RecurrenceRuleScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.property.RecurrenceRule; 4 | import biweekly.util.Recurrence; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link RecurrenceRule} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class RecurrenceRuleScribe extends RecurrencePropertyScribe { 36 | public RecurrenceRuleScribe() { 37 | super(RecurrenceRule.class, "RRULE"); 38 | } 39 | 40 | @Override 41 | protected RecurrenceRule newInstance(Recurrence recur) { 42 | return new RecurrenceRule(recur); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/biweekly/property/IntegerProperty.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | /* 4 | Copyright (c) 2013-2024, Michael Angstadt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /** 29 | * Represents a property whose value is an integer. 30 | * @author Michael Angstadt 31 | */ 32 | public class IntegerProperty extends ValuedProperty { 33 | /** 34 | * Creates a new integer property. 35 | * @param value the property's value 36 | */ 37 | public IntegerProperty(Integer value) { 38 | super(value); 39 | } 40 | 41 | /** 42 | * Copy constructor. 43 | * @param original the property to make a copy of 44 | */ 45 | public IntegerProperty(IntegerProperty original) { 46 | super(original); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ResourcesScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalDataType; 4 | import biweekly.parameter.ICalParameters; 5 | import biweekly.property.Resources; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * Marshals {@link Resources} properties. 34 | * @author Michael Angstadt 35 | */ 36 | public class ResourcesScribe extends TextListPropertyScribe { 37 | public ResourcesScribe() { 38 | super(Resources.class, "RESOURCES"); 39 | } 40 | 41 | @Override 42 | public Resources newInstance(ICalDataType dataType, ICalParameters parameters) { 43 | return new Resources(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/xml/XCalQNames.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.xml; 2 | 3 | import static biweekly.io.xml.XCalNamespaceContext.XCAL_NS; 4 | 5 | import javax.xml.namespace.QName; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * Contains the XML element names of some of the standard xCard elements. 34 | * @author Michael Angstadt 35 | */ 36 | public interface XCalQNames { 37 | QName ICALENDAR = new QName(XCAL_NS, "icalendar"); 38 | QName VCALENDAR = new QName(XCAL_NS, "vcalendar"); 39 | QName COMPONENTS = new QName(XCAL_NS, "components"); 40 | QName PROPERTIES = new QName(XCAL_NS, "properties"); 41 | QName PARAMETERS = new QName(XCAL_NS, "parameters"); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/CategoriesScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalDataType; 4 | import biweekly.parameter.ICalParameters; 5 | import biweekly.property.Categories; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * Marshals {@link Categories} properties. 34 | * @author Michael Angstadt 35 | */ 36 | public class CategoriesScribe extends TextListPropertyScribe { 37 | public CategoriesScribe() { 38 | super(Categories.class, "CATEGORIES"); 39 | } 40 | 41 | @Override 42 | public Categories newInstance(ICalDataType dataType, ICalParameters parameters) { 43 | return new Categories(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/RawComponentScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import biweekly.component.RawComponent; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * @author Michael Angstadt 32 | */ 33 | public class RawComponentScribe extends ICalComponentScribe { 34 | /** 35 | * Creates a new raw component scribe. 36 | * @param componentName the component's name (e.g. "X-PARTY") 37 | */ 38 | public RawComponentScribe(String componentName) { 39 | super(RawComponent.class, componentName); 40 | } 41 | 42 | @Override 43 | protected RawComponent _newInstance() { 44 | return new RawComponent(componentName); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/ObservanceScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.component.Observance; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @author Michael Angstadt 36 | */ 37 | public abstract class ObservanceScribe extends ICalComponentScribe { 38 | protected ObservanceScribe(Class clazz, String componentName) { 39 | super(clazz, componentName); 40 | } 41 | 42 | @Override 43 | public Set getSupportedVersions() { 44 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/biweekly/util/IOUtils.java: -------------------------------------------------------------------------------- 1 | package biweekly.util; 2 | 3 | import java.io.Closeable; 4 | import java.io.IOException; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * I/O helper classes. 33 | * @author Michael Angstadt 34 | */ 35 | public final class IOUtils { 36 | /** 37 | * Closes a closeable resource, catching its {@link IOException}. 38 | * @param closeable the resource to close (can be null) 39 | */ 40 | public static void closeQuietly(Closeable closeable) { 41 | try { 42 | if (closeable != null) { 43 | closeable.close(); 44 | } 45 | } catch (IOException e) { 46 | //ignore 47 | } 48 | } 49 | 50 | private IOUtils() { 51 | //hide 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/biweekly/util/com/google/ical/util/Predicate.java: -------------------------------------------------------------------------------- 1 | // CopyrightGoogle Inc. All rights reserved. 2 | 3 | /* 4 | Copyright (c) 2013-2024, Michael Angstadt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | package biweekly.util.com.google.ical.util; 29 | 30 | import java.io.Serializable; 31 | 32 | /** 33 | * A function with a boolean return value. Useful for filtering. 34 | * @author mikesamuel+svn@gmail.com (Mike Samuel) 35 | * @author Michael Angstadt 36 | * @param the input type 37 | */ 38 | public interface Predicate extends Serializable { 39 | /** 40 | * Applies this predicate to the given object. 41 | * @param input the input 42 | * @return the value of this predicate when applied to the input 43 | */ 44 | boolean apply(T input); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/biweekly/property/TextProperty.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | /* 4 | Copyright (c) 2013-2024, Michael Angstadt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /** 29 | * Represents a property whose value is a plain-text string. Note that this 30 | * includes both text and URI values. 31 | * @author Michael Angstadt 32 | */ 33 | public class TextProperty extends ValuedProperty { 34 | /** 35 | * Creates a new text property. 36 | * @param value the property's value 37 | */ 38 | public TextProperty(String value) { 39 | super(value); 40 | } 41 | 42 | /** 43 | * Copy constructor. 44 | * @param original the property to make a copy of 45 | */ 46 | public TextProperty(TextProperty original) { 47 | super(original); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/VJournalScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.component.VJournal; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @author Michael Angstadt 36 | */ 37 | public class VJournalScribe extends ICalComponentScribe { 38 | public VJournalScribe() { 39 | super(VJournal.class, "VJOURNAL"); 40 | } 41 | 42 | @Override 43 | protected VJournal _newInstance() { 44 | return new VJournal(); 45 | } 46 | 47 | @Override 48 | public Set getSupportedVersions() { 49 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/component/VTimezoneScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.component; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.component.VTimezone; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @author Michael Angstadt 36 | */ 37 | public class VTimezoneScribe extends ICalComponentScribe { 38 | public VTimezoneScribe() { 39 | super(VTimezone.class, "VTIMEZONE"); 40 | } 41 | 42 | @Override 43 | protected VTimezone _newInstance() { 44 | return new VTimezone((String) null); 45 | } 46 | 47 | @Override 48 | public Set getSupportedVersions() { 49 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/resources/biweekly/io/text/outlook-2010.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN 3 | VERSION:2.0 4 | METHOD:REQUEST 5 | X-MS-OLK-FORCEINSPECTOROPEN:TRUE 6 | BEGIN:VTIMEZONE 7 | TZID:Eastern Standard Time 8 | BEGIN:STANDARD 9 | DTSTART:16011104T020000 10 | RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11 11 | TZOFFSETFROM:-0400 12 | TZOFFSETTO:-0500 13 | END:STANDARD 14 | BEGIN:DAYLIGHT 15 | DTSTART:16010311T020000 16 | RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3 17 | TZOFFSETFROM:-0500 18 | TZOFFSETTO:-0400 19 | END:DAYLIGHT 20 | END:VTIMEZONE 21 | BEGIN:VEVENT 22 | ATTENDEE;CN="Doe, John";ROLE=OPT-PARTICIPANT;RSVP=FALSE:mailto:johndoe@exam 23 | ple.com 24 | ATTENDEE;CN="Doe, Jane";ROLE=CHAIR;RSVP=TRUE:mailto:janedoe@example.com 25 | CLASS:PUBLIC 26 | CREATED:20130608T200410Z 27 | DESCRIPTION:Meeting will discuss objectives for next project.\nWill include a 28 | presentation and food. 29 | DTEND;TZID="Eastern Standard Time":20130610T130000 30 | DTSTAMP:20130425T155807Z 31 | DTSTART;TZID="Eastern Standard Time":20130610T120000 32 | LAST-MODIFIED:20130608T200410Z 33 | LOCATION:Auditorium 16 34 | ORGANIZER;CN="Smith, Bob":mailto:bobsmith@example.com 35 | PRIORITY:5 36 | SEQUENCE:1 37 | SUMMARY;LANGUAGE=en-us:Team Meeting 38 | TRANSP:OPAQUE 39 | UID:040000009200E00074C5B7101A82E00800000000C0383BE68041CE01000000000000000 40 | 01000000070D00A2F625AC34BB6542DE0D19E67E1 41 | X-ALT-DESC;FMTTYPE=text/html:\n\n\n\n\n\n\n\n\n

Meeting will discuss objectives for next project.\nWi 46 | ll include a presentation and food.

\n 47 | X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE 48 | X-MICROSOFT-CDO-IMPORTANCE:1 49 | X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY 50 | X-MICROSOFT-DISALLOW-COUNTER:TRUE 51 | X-MS-OLK-APPTLASTSEQUENCE:1 52 | X-MS-OLK-APPTSEQTIME:20130425T124303Z 53 | X-MS-OLK-CONFTYPE:0 54 | END:VEVENT 55 | END:VCALENDAR 56 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/RepeatScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.Repeat; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link Repeat} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class RepeatScribe extends IntegerPropertyScribe { 39 | public RepeatScribe() { 40 | super(Repeat.class, "REPEAT"); 41 | } 42 | 43 | @Override 44 | protected Repeat newInstance(Integer value) { 45 | return new Repeat(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/CreatedScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.Date; 4 | 5 | import biweekly.ICalVersion; 6 | import biweekly.property.Created; 7 | 8 | /* 9 | Copyright (c) 2013-2024, Michael Angstadt 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /** 34 | * Marshals {@link Created} properties. 35 | * @author Michael Angstadt 36 | */ 37 | public class CreatedScribe extends DateTimePropertyScribe { 38 | public CreatedScribe() { 39 | super(Created.class, "CREATED"); 40 | } 41 | 42 | @Override 43 | public String getPropertyName(ICalVersion version) { 44 | return (version == ICalVersion.V1_0) ? "DCREATED" : super.getPropertyName(version); 45 | } 46 | 47 | @Override 48 | protected Created newInstance(Date date) { 49 | return new Created(date); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ActionScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.Action; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link Action} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class ActionScribe extends TextPropertyScribe { 39 | public ActionScribe() { 40 | super(Action.class, "ACTION"); 41 | } 42 | 43 | @Override 44 | protected Action newInstance(String value, ICalVersion version) { 45 | return new Action(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/MethodScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.Method; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link Method} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class MethodScribe extends TextPropertyScribe { 39 | public MethodScribe() { 40 | super(Method.class, "METHOD"); 41 | } 42 | 43 | @Override 44 | protected Method newInstance(String value, ICalVersion version) { 45 | return new Method(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/test/java/biweekly/io/scribe/property/ScribeTest.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import org.junit.ClassRule; 4 | 5 | import biweekly.property.ICalProperty; 6 | import biweekly.util.DefaultTimezoneRule; 7 | 8 | /* 9 | Copyright (c) 2013-2024, Michael Angstadt 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /** 34 | * Parent class for all scribe unit tests. 35 | * @author Michael Angstadt 36 | * @param

the property class 37 | */ 38 | public class ScribeTest

{ 39 | @ClassRule 40 | public static final DefaultTimezoneRule tzRule = new DefaultTimezoneRule(1, 0); 41 | 42 | protected final ICalPropertyScribe

scribe; 43 | protected final Sensei

sensei; 44 | 45 | protected ScribeTest(ICalPropertyScribe

scribe) { 46 | this.scribe = scribe; 47 | sensei = new Sensei

(scribe); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/biweekly/property/ExceptionRuleTest.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import static biweekly.util.TestUtils.assertValidate; 4 | 5 | import org.junit.Test; 6 | 7 | import static biweekly.ICalVersion.*; 8 | 9 | import biweekly.util.Frequency; 10 | import biweekly.util.Recurrence; 11 | 12 | /* 13 | Copyright (c) 2013-2024, Michael Angstadt 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 19 | 1. Redistributions of source code must retain the above copyright notice, this 20 | list of conditions and the following disclaimer. 21 | 2. Redistributions in binary form must reproduce the above copyright notice, 22 | this list of conditions and the following disclaimer in the documentation 23 | and/or other materials provided with the distribution. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 26 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 29 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 32 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | */ 36 | 37 | /** 38 | * @author Michael Angstadt 39 | */ 40 | public class ExceptionRuleTest { 41 | @Test 42 | public void validate() { 43 | ExceptionRule property = new ExceptionRule(new Recurrence.Builder(Frequency.DAILY).build()); 44 | assertValidate(property).versions(V1_0, V2_0_DEPRECATED).run(); 45 | 46 | property = new ExceptionRule(new Recurrence.Builder(Frequency.DAILY).build()); 47 | assertValidate(property).versions(V2_0).run(37); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/CommentScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.Comment; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link Comment} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class CommentScribe extends TextPropertyScribe { 39 | public CommentScribe() { 40 | super(Comment.class, "COMMENT"); 41 | } 42 | 43 | @Override 44 | protected Comment newInstance(String value, ICalVersion version) { 45 | return new Comment(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ContactScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.Contact; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link Contact} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class ContactScribe extends TextPropertyScribe { 39 | public ContactScribe() { 40 | super(Contact.class, "CONTACT"); 41 | } 42 | 43 | @Override 44 | protected Contact newInstance(String value, ICalVersion version) { 45 | return new Contact(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/property/DateTimeProperty.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import java.util.Date; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Represents a property whose value is a date-time value. These properties are 32 | * always written in UTC time. 33 | * @author Michael Angstadt 34 | */ 35 | public class DateTimeProperty extends ValuedProperty { 36 | /** 37 | * Creates a new property. 38 | * @param value the date-time value 39 | */ 40 | public DateTimeProperty(Date value) { 41 | super(value); 42 | } 43 | 44 | /** 45 | * Copy constructor. 46 | * @param original the property to make a copy of 47 | */ 48 | public DateTimeProperty(DateTimeProperty original) { 49 | super(original); 50 | value = new Date(original.value.getTime()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/TimezoneScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.Timezone; 8 | import biweekly.util.UtcOffset; 9 | 10 | /* 11 | Copyright (c) 2013-2024, Michael Angstadt 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /** 36 | * Marshals {@link Timezone} properties. 37 | * @author Michael Angstadt 38 | */ 39 | public class TimezoneScribe extends UtcOffsetPropertyScribe { 40 | public TimezoneScribe() { 41 | super(Timezone.class, "TZ"); 42 | } 43 | 44 | @Override 45 | protected Timezone newInstance(UtcOffset offset) { 46 | return new Timezone(offset); 47 | } 48 | 49 | @Override 50 | public Set getSupportedVersions() { 51 | return EnumSet.of(ICalVersion.V1_0); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/biweekly/io/DefaultGlobalTimezoneIdResolverTest.java: -------------------------------------------------------------------------------- 1 | package biweekly.io; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNull; 5 | import org.junit.Test; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * @author Michael Angstadt 34 | */ 35 | public class DefaultGlobalTimezoneIdResolverTest { 36 | @Test 37 | public void resolve() { 38 | DefaultGlobalTimezoneIdResolver resolver = new DefaultGlobalTimezoneIdResolver(); 39 | 40 | assertEquals("America/New_York", resolver.resolve("America/New_York").getID()); 41 | assertEquals("America/New_York", resolver.resolve("mozilla.org/20050126_1/America/New_York").getID()); 42 | 43 | assertNull(resolver.resolve("Foo/Bar")); 44 | assertNull(resolver.resolve("mozilla.org/20050126_1/Foo/Bar")); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/biweekly/property/ExceptionDatesTest.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import static biweekly.util.TestUtils.assertValidate; 4 | 5 | import org.junit.Test; 6 | 7 | import biweekly.util.ICalDate; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @author Michael Angstadt 36 | */ 37 | public class ExceptionDatesTest { 38 | @Test 39 | public void validate() { 40 | ExceptionDates property = new ExceptionDates(); 41 | assertValidate(property).run(26); 42 | 43 | property = new ExceptionDates(); 44 | property.getValues().add(new ICalDate(true)); 45 | property.getValues().add(new ICalDate(false)); 46 | assertValidate(property).run(50); 47 | 48 | property = new ExceptionDates(); 49 | property.getValues().add(new ICalDate()); 50 | assertValidate(property).run(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/TimezoneIdScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.TimezoneId; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link TimezoneId} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class TimezoneIdScribe extends TextPropertyScribe { 39 | public TimezoneIdScribe() { 40 | super(TimezoneId.class, "TZID"); 41 | } 42 | 43 | @Override 44 | protected TimezoneId newInstance(String value, ICalVersion version) { 45 | return new TimezoneId(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/TimezoneNameScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.TimezoneName; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link TimezoneName} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class TimezoneNameScribe extends TextPropertyScribe { 39 | public TimezoneNameScribe() { 40 | super(TimezoneName.class, "TZNAME"); 41 | } 42 | 43 | @Override 44 | protected TimezoneName newInstance(String value, ICalVersion version) { 45 | return new TimezoneName(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/test/java/biweekly/util/IOUtilsTest.java: -------------------------------------------------------------------------------- 1 | package biweekly.util; 2 | 3 | import static org.mockito.Mockito.doThrow; 4 | import static org.mockito.Mockito.mock; 5 | import static org.mockito.Mockito.verify; 6 | 7 | import java.io.Closeable; 8 | import java.io.IOException; 9 | 10 | import org.junit.Test; 11 | 12 | /* 13 | Copyright (c) 2013-2024, Michael Angstadt 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 19 | 1. Redistributions of source code must retain the above copyright notice, this 20 | list of conditions and the following disclaimer. 21 | 2. Redistributions in binary form must reproduce the above copyright notice, 22 | this list of conditions and the following disclaimer in the documentation 23 | and/or other materials provided with the distribution. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 26 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 29 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 32 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | */ 36 | 37 | /** 38 | * @author Michael Angstadt 39 | */ 40 | public class IOUtilsTest { 41 | @Test 42 | public void closeQuietly() throws Exception { 43 | IOUtils.closeQuietly(null); 44 | 45 | Closeable closeable = mock(Closeable.class); 46 | IOUtils.closeQuietly(closeable); 47 | verify(closeable).close(); 48 | 49 | closeable = mock(Closeable.class); 50 | doThrow(new IOException()).when(closeable).close(); 51 | IOUtils.closeQuietly(closeable); 52 | verify(closeable).close(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/CalendarScaleScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.CalendarScale; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link CalendarScale} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class CalendarScaleScribe extends TextPropertyScribe { 39 | public CalendarScaleScribe() { 40 | super(CalendarScale.class, "CALSCALE"); 41 | } 42 | 43 | @Override 44 | protected CalendarScale newInstance(String value, ICalVersion version) { 45 | return new CalendarScale(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/PercentCompleteScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.PercentComplete; 8 | 9 | /* 10 | Copyright (c) 2013-2024, Michael Angstadt 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * Marshals {@link PercentComplete} properties. 36 | * @author Michael Angstadt 37 | */ 38 | public class PercentCompleteScribe extends IntegerPropertyScribe { 39 | public PercentCompleteScribe() { 40 | super(PercentComplete.class, "PERCENT-COMPLETE"); 41 | } 42 | 43 | @Override 44 | protected PercentComplete newInstance(Integer value) { 45 | return new PercentComplete(value); 46 | } 47 | 48 | @Override 49 | public Set getSupportedVersions() { 50 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/parameter/EnumParameterValue.java: -------------------------------------------------------------------------------- 1 | package biweekly.parameter; 2 | 3 | /* 4 | Copyright (c) 2013-2024, Michael Angstadt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /** 29 | * Represents a value from a parameter that has a list of pre-defined values 30 | * (for example, the VALUE or ACTION parameters). 31 | * @author Michael Angstadt 32 | */ 33 | public class EnumParameterValue { 34 | /** 35 | * The value (for example, "text"). 36 | */ 37 | protected final String value; 38 | 39 | /** 40 | * @param value the value (e.g. "text") 41 | */ 42 | protected EnumParameterValue(String value) { 43 | this.value = value; 44 | } 45 | 46 | /** 47 | * Gets the value of the parameter. 48 | * @return the value of the parameter (e.g. "text") 49 | */ 50 | public String getValue() { 51 | return value; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return value; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/RecurrenceIdScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.RecurrenceId; 8 | import biweekly.util.ICalDate; 9 | 10 | /* 11 | Copyright (c) 2013-2024, Michael Angstadt 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /** 36 | * Marshals {@link RecurrenceId} properties. 37 | * @author Michael Angstadt 38 | */ 39 | public class RecurrenceIdScribe extends DateOrDateTimePropertyScribe { 40 | public RecurrenceIdScribe() { 41 | super(RecurrenceId.class, "RECURRENCE-ID"); 42 | } 43 | 44 | @Override 45 | protected RecurrenceId newInstance(ICalDate date) { 46 | return new RecurrenceId(date); 47 | } 48 | 49 | @Override 50 | public Set getSupportedVersions() { 51 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/TimezoneUrlScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalDataType; 7 | import biweekly.ICalVersion; 8 | import biweekly.property.TimezoneUrl; 9 | 10 | /* 11 | Copyright (c) 2013-2024, Michael Angstadt 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /** 36 | * Marshals {@link TimezoneUrl} properties. 37 | * @author Michael Angstadt 38 | */ 39 | public class TimezoneUrlScribe extends TextPropertyScribe { 40 | public TimezoneUrlScribe() { 41 | super(TimezoneUrl.class, "TZURL", ICalDataType.URI); 42 | } 43 | 44 | @Override 45 | protected TimezoneUrl newInstance(String value, ICalVersion version) { 46 | return new TimezoneUrl(value); 47 | } 48 | 49 | @Override 50 | public Set getSupportedVersions() { 51 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/TimezoneOffsetToScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.TimezoneOffsetTo; 8 | import biweekly.util.UtcOffset; 9 | 10 | /* 11 | Copyright (c) 2013-2024, Michael Angstadt 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /** 36 | * Marshals {@link TimezoneOffsetTo} properties. 37 | * @author Michael Angstadt 38 | */ 39 | public class TimezoneOffsetToScribe extends UtcOffsetPropertyScribe { 40 | public TimezoneOffsetToScribe() { 41 | super(TimezoneOffsetTo.class, "TZOFFSETTO"); 42 | } 43 | 44 | @Override 45 | protected TimezoneOffsetTo newInstance(UtcOffset offset) { 46 | return new TimezoneOffsetTo(offset); 47 | } 48 | 49 | @Override 50 | public Set getSupportedVersions() { 51 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/TimezoneOffsetFromScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import java.util.EnumSet; 4 | import java.util.Set; 5 | 6 | import biweekly.ICalVersion; 7 | import biweekly.property.TimezoneOffsetFrom; 8 | import biweekly.util.UtcOffset; 9 | 10 | /* 11 | Copyright (c) 2013-2024, Michael Angstadt 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /** 36 | * Marshals {@link TimezoneOffsetFrom} properties. 37 | * @author Michael Angstadt 38 | */ 39 | public class TimezoneOffsetFromScribe extends UtcOffsetPropertyScribe { 40 | public TimezoneOffsetFromScribe() { 41 | super(TimezoneOffsetFrom.class, "TZOFFSETFROM"); 42 | } 43 | 44 | @Override 45 | protected TimezoneOffsetFrom newInstance(UtcOffset offset) { 46 | return new TimezoneOffsetFrom(offset); 47 | } 48 | 49 | @Override 50 | public Set getSupportedVersions() { 51 | return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/util/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/component/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/chain/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/json/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/scribe/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/text/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/xml/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/parameter/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/property/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/ImageScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalDataType; 4 | import biweekly.property.Image; 5 | 6 | /* 7 | Copyright (c) 2013-2024, Michael Angstadt 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | 1. Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * Marshals {@link Image} properties. 33 | * @author Michael Angstadt 34 | */ 35 | public class ImageScribe extends BinaryPropertyScribe { 36 | public ImageScribe() { 37 | super(Image.class, "IMAGE"); 38 | } 39 | 40 | @Override 41 | protected Image newInstance(byte[] data) { 42 | /* 43 | * Note: "formatType" will be set when the parameters are assigned to 44 | * the property object. 45 | */ 46 | return new Image(null, data); 47 | } 48 | 49 | @Override 50 | protected Image newInstance(String value, ICalDataType dataType) { 51 | /* 52 | * Note: "formatType" will be set when the parameters are assigned to 53 | * the property object. 54 | */ 55 | return new Image(null, value); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/scribe/component/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/javadoc/biweekly/io/scribe/property/doc-files/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/SkipMeException.java: -------------------------------------------------------------------------------- 1 | package biweekly.io; 2 | 3 | import biweekly.ICalendar; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Thrown during the reading or writing of an iCalendar property to show that 32 | * the property should not be written to the iCalendar data stream or not be 33 | * included in the parsed {@link ICalendar} object. 34 | * @author Michael Angstadt 35 | */ 36 | public class SkipMeException extends RuntimeException { 37 | private static final long serialVersionUID = 3384029056232963767L; 38 | private final String reason; 39 | 40 | /** 41 | * Creates a new "skip me" exception. 42 | * @param reason the reason why the property was skipped 43 | */ 44 | public SkipMeException(String reason) { 45 | super(reason); 46 | this.reason = reason; 47 | } 48 | 49 | /** 50 | * Gets the reason why the property was skipped. 51 | * @return the reason 52 | */ 53 | public String getReason() { 54 | return reason; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/biweekly/util/Utf8Reader.java: -------------------------------------------------------------------------------- 1 | package biweekly.util; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.InputStream; 7 | import java.io.InputStreamReader; 8 | import java.nio.charset.Charset; 9 | 10 | /* 11 | Copyright (c) 2013-2024, Michael Angstadt 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /** 36 | * Reads characters that are encoded in UTF-8. 37 | * @author Michael Angstadt 38 | */ 39 | public class Utf8Reader extends InputStreamReader { 40 | /** 41 | * Creates a new UTF-8 reader. 42 | * @param in the input stream to read from 43 | */ 44 | public Utf8Reader(InputStream in) { 45 | super(in, Charset.forName("UTF-8")); 46 | } 47 | 48 | /** 49 | * Creates a new UTF-8 reader. 50 | * @param file the file to read from 51 | * @throws FileNotFoundException if the file does not exist or cannot be 52 | * opened 53 | */ 54 | public Utf8Reader(File file) throws FileNotFoundException { 55 | this(new FileInputStream(file)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/GlobalTimezoneIdResolver.java: -------------------------------------------------------------------------------- 1 | package biweekly.io; 2 | 3 | import java.util.TimeZone; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Gets Java {@link TimeZone} objects that correspond with TZID parameters that 32 | * contain global timezone IDs (as opposed to IDs that correspond with a 33 | * VTIMEZONE component). 34 | * @author Michael Angstadt 35 | * @see RFC 5545 36 | * section 3.8.3.1 37 | * @see RFC 2445 38 | * section 4.2.19 39 | */ 40 | public interface GlobalTimezoneIdResolver { 41 | /** 42 | * Returns an appropriate Java {@link TimeZone} object that corresponds to 43 | * the given global ID. 44 | * @param globalId the global ID (the value of the TZID parameter, without 45 | * the forward slash prefix) 46 | * @return the corresponding {@link TimeZone} object or null if the global 47 | * ID is not recognized 48 | */ 49 | TimeZone resolve(String globalId); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/biweekly/util/com/google/ical/values/DateTimeValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * All Rights Reserved. 16 | */ 17 | 18 | /* 19 | Copyright (c) 2013-2024, Michael Angstadt 20 | All rights reserved. 21 | 22 | Redistribution and use in source and binary forms, with or without 23 | modification, are permitted provided that the following conditions are met: 24 | 25 | 1. Redistributions of source code must retain the above copyright notice, this 26 | list of conditions and the following disclaimer. 27 | 2. Redistributions in binary form must reproduce the above copyright notice, 28 | this list of conditions and the following disclaimer in the documentation 29 | and/or other materials provided with the distribution. 30 | 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 32 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 33 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 34 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 35 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 36 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 37 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 38 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 40 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | */ 42 | 43 | package biweekly.util.com.google.ical.values; 44 | 45 | /** 46 | * An instant in time. 47 | * @author Neal Gafter 48 | * @author Michael Angstadt 49 | */ 50 | public interface DateTimeValue extends DateValue, TimeValue { 51 | //simple union 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/biweekly/property/TimezoneId.java: -------------------------------------------------------------------------------- 1 | package biweekly.property; 2 | 3 | import biweekly.component.VTimezone; 4 | 5 | /* 6 | Copyright (c) 2013-2024, Michael Angstadt 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * Defines a unique identifier for a {@link VTimezone} component. The identifier 32 | * must be unique within the scope of the iCalendar object. 33 | * @author Michael Angstadt 34 | * @see RFC 5545 35 | * p.102-3 36 | * @see RFC 2445 p.97-8 37 | */ 38 | public class TimezoneId extends TextProperty { 39 | /** 40 | * Creates a timezone identifier property. 41 | * @param timezone the timezone identifier 42 | */ 43 | public TimezoneId(String timezone) { 44 | super(timezone); 45 | } 46 | 47 | /** 48 | * Copy constructor. 49 | * @param original the property to make a copy of 50 | */ 51 | public TimezoneId(TimezoneId original) { 52 | super(original); 53 | } 54 | 55 | @Override 56 | public TimezoneId copy() { 57 | return new TimezoneId(this); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/biweekly/io/scribe/property/StatusScribe.java: -------------------------------------------------------------------------------- 1 | package biweekly.io.scribe.property; 2 | 3 | import biweekly.ICalVersion; 4 | import biweekly.io.WriteContext; 5 | import biweekly.property.Status; 6 | 7 | /* 8 | Copyright (c) 2013-2024, Michael Angstadt 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /** 33 | * Marshals {@link Status} properties. 34 | * @author Michael Angstadt 35 | */ 36 | public class StatusScribe extends TextPropertyScribe { 37 | public StatusScribe() { 38 | super(Status.class, "STATUS"); 39 | } 40 | 41 | @Override 42 | protected String _writeText(Status property, WriteContext context) { 43 | if (context.getVersion() == ICalVersion.V1_0 && property.isNeedsAction()) { 44 | //vCal doesn't have a hyphen in the value 45 | return "NEEDS ACTION"; 46 | } 47 | return super._writeText(property, context); 48 | } 49 | 50 | @Override 51 | protected Status newInstance(String value, ICalVersion version) { 52 | if (version == ICalVersion.V1_0 && "NEEDS ACTION".equalsIgnoreCase(value)) { 53 | //vCal doesn't have a hyphen in the value 54 | return Status.needsAction(); 55 | } 56 | return new Status(value); 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/biweekly/util/com/google/ical/compat/javautil/DateIterable.java: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /* 16 | Copyright (c) 2013-2024, Michael Angstadt 17 | All rights reserved. 18 | 19 | Redistribution and use in source and binary forms, with or without 20 | modification, are permitted provided that the following conditions are met: 21 | 22 | 1. Redistributions of source code must retain the above copyright notice, this 23 | list of conditions and the following disclaimer. 24 | 2. Redistributions in binary form must reproduce the above copyright notice, 25 | this list of conditions and the following disclaimer in the documentation 26 | and/or other materials provided with the distribution. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 29 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 30 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 31 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 32 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 33 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 35 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 37 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | 40 | package biweekly.util.com.google.ical.compat.javautil; 41 | 42 | import java.util.Date; 43 | 44 | /** 45 | * Iterates over a series of {@link Date} objects in ascending order. 46 | * @author mikesamuel+svn@gmail.com (Mike Samuel) 47 | * @author Michael Angstadt 48 | */ 49 | public interface DateIterable extends Iterable { 50 | DateIterator iterator(); 51 | } 52 | --------------------------------------------------------------------------------