Merge branch 'master' of github.com:Multiverse/Multiverse-Core

This commit is contained in:
Eric Stokes 2011-11-30 19:38:58 -07:00
commit a0ab24a132
1 changed files with 14 additions and 3 deletions

View File

@ -2,12 +2,24 @@ package com.onarandombox.MultiverseCore.utils.webpaste;
import java.net.URL;
/**
* An interface to a web-based text-pasting service. Classes implementing this
* interface should implement its methods to send data to an online text-sharing
* service, such as pastebin.com. Conventionally, a paste is accomplished by (given
* some PasteService instance ps):
*
* {@code ps.postData(ps.encodeData(someString), ps.getPostURL());}
*
* Services that provide a distinction between "public" and "private" pastes
* should implement a custom constructor that specifies which kind the PasteService
* instance is submitting; an example of this is the PastiePasteService class.
*/
public interface PasteService {
/**
* Encode the given String data into a format suitable for transmission in an HTTP request.
*
* @param data The raw data to encode.
* @param isPrivate Whether the paste is desired to be private.
* @return A URL-encoded string.
*/
public String encodeData(String data);
@ -15,7 +27,6 @@ public interface PasteService {
/**
* Get the URL to which this paste service sends new pastes.
*
* @param isPrivate Whether the paste is desired to be private.
* @return The URL that will be accessed to complete the paste.
*/
public URL getPostURL();
@ -26,8 +37,8 @@ public interface PasteService {
* @param encodedData A URL-encoded String containing the full request to post to
* the given URL. Can be the result of calling #encodeData().
* @param url The URL to which to paste. Can be the result of calling #getPostURL().
* @param isPrivate Whether the paste is desired to be private.
* @return The URL at which the new paste is visible.
*/
public String postData(String encodedData, URL url) throws PasteFailedException;
}