16ac43ec0a1115c8b85da5b95b196baf58c631b8
[jFCPlib.git] / src / net / pterodactylus / fcp / SubscribedUSKUpdate.java
1 /*
2  * jSite2 - SubscribedUSKUpdate.java -
3  * Copyright © 2008 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package net.pterodactylus.fcp;
21
22 /**
23  * A “SubscribedUSKUpdate” message is sent each time a new edition of a USK that
24  * was previously subscribed to with {@link SubscribeUSK} was found. Note that
25  * if the new edition that was found is several editions ahead of the currently
26  * last known edition, you will received a SubscribedUSKUpdate for each edition
27  * inbetween as welL!
28  * 
29  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
30  * @version $Id$
31  */
32 public class SubscribedUSKUpdate extends BaseMessage {
33
34         /**
35          * Creates a new “SubscribedUSKUpdate” message that wraps the received
36          * message.
37          * 
38          * @param receivedMessage
39          *            The received message
40          */
41         SubscribedUSKUpdate(FcpMessage receivedMessage) {
42                 super(receivedMessage);
43         }
44
45         /**
46          * Returns the identifier of the subscription.
47          * 
48          * @return The identifier of the subscription
49          */
50         public String getIdentifier() {
51                 return getField("Identifier");
52         }
53
54         /**
55          * Returns the new edition that was found.
56          * 
57          * @return The new edition
58          */
59         public int getEdition() {
60                 return FcpUtils.safeParseInt(getField("Edition"));
61         }
62
63         /**
64          * Returns the complete URI, including the new edition.
65          * 
66          * @return The complete URI
67          */
68         public String getURI() {
69                 return getField("URI");
70         }
71
72 }