X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2FAllData.java;h=621e99314b6f061dbbbb80d19a2b528bb0fc8602;hb=05e52ccf3f6e8f2645031cfd3b35f3f71d3a2b82;hp=d1541bfedeaafea8bd41ff42c6f3c247d2abc632;hpb=508624458578f01a393f8b44f32b98b40054fdc8;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/AllData.java b/src/main/java/net/pterodactylus/fcp/AllData.java index d1541bf..621e993 100644 --- a/src/main/java/net/pterodactylus/fcp/AllData.java +++ b/src/main/java/net/pterodactylus/fcp/AllData.java @@ -22,16 +22,16 @@ import java.io.InputStream; /** * The “AllData” message carries the payload of a successful {@link ClientGet} - * request. You will only received this message if the {@link ClientGet} request - * was started with a return type of {@link ReturnType#direct}. If you get this - * message and decide that the data is for you, call + * request. You will only received this message if the {@link ClientGet} + * request was started with a return type of {@link ReturnType#direct}. If you + * get this message and decide that the data is for you, call * {@link #getPayloadInputStream()} to get the data. If an AllData message * passes through all registered {@link FcpListener}s without the payload being * consumed, the payload is discarded! * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ -public class AllData extends BaseMessage { +public class AllData extends BaseMessage implements Identifiable { /** The payload. */ private InputStream payloadInputStream; @@ -44,7 +44,7 @@ public class AllData extends BaseMessage { * @param payloadInputStream * The payload */ - AllData(FcpMessage receivedMessage, InputStream payloadInputStream) { + public AllData(FcpMessage receivedMessage, InputStream payloadInputStream) { super(receivedMessage); this.payloadInputStream = payloadInputStream; } @@ -54,6 +54,7 @@ public class AllData extends BaseMessage { * * @return The identifier of the request */ + @Override public String getIdentifier() { return getField("Identifier"); } @@ -99,4 +100,13 @@ public class AllData extends BaseMessage { return payloadInputStream; } + /** + * Returns the content type of the found file. + * + * @return The content type + */ + public String getContentType() { + return getField("Metadata.ContentType"); + } + }