2 * jFCPlib - FCPPluginMessage.java - Copyright © 2008–2016 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.fcp;
20 import java.io.InputStream;
23 * An “CPPluginMessage” sends a message with custom parameters and (optional)
24 * payload to a plugin.
26 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
28 public class FCPPluginMessage extends FcpMessage {
31 * @deprecated Use {@link #FCPPluginMessage(String, String)} instead
34 public FCPPluginMessage(String pluginClass) {
35 super("FCPPluginMessage");
36 setField("PluginName", pluginClass);
39 public FCPPluginMessage(String identifier, String pluginClass) {
41 setField("Identifier", identifier);
45 * @deprecated Use {@link #FCPPluginMessage(String, String)} instead
48 public void setIdentifier(String identifier) {
49 setField("Identifier", identifier);
53 * Sets a custom parameter for the plugin.
56 * The key of the parameter
58 * The value of the parameter
60 public void setParameter(String key, String value) {
61 setField("Param." + key, value);
65 * @deprecated Use {@link #setData(InputStream, long)} instead
68 public void setDataLength(long dataLength) {
69 setField("DataLength", String.valueOf(dataLength));
72 public void setData(InputStream payloadInputStream, long dataLength) {
73 setPayloadInputStream(payloadInputStream);
74 setDataLength(dataLength);