Class PastebinUtil

java.lang.Object
dev.cwhead.GravesX.util.PastebinUtil

public final class PastebinUtil extends Object
Minimal Pastebin API client for posting text dumps. Returns the paste URL on success, or null on failure.
  • Field Details

  • Constructor Details

    • PastebinUtil

      private PastebinUtil()
  • Method Details

    • post

      public static String post(String devKey, String userKey, String title, String content, String privacy, String expire)
      Post text content to Pastebin.
      Parameters:
      devKey - Pastebin API dev key (required)
      userKey - Pastebin user key (optional; required for PRIVATE pastes)
      title - Paste title
      content - Paste body (text)
      privacy - "PUBLIC" | "UNLISTED" | "PRIVATE" (case-insensitive)
      expire - "N" | "10M" | "1H" | "1D" | "1W" | "2W" | "1M" | "6M" | "1Y"
      Returns:
      The paste URL on success; null on error.
    • mapPrivacyToInt

      private static int mapPrivacyToInt(String privacy)
    • append

      private static void append(StringBuilder sb, String key, String val)
    • safeUpper

      private static String safeUpper(String in, String dflt)