Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.

Griefed/hastebin.java

 
 

Repository files navigation

hastebin.java

[[TOC]]

A simple Hastebin API wrapper for Java. Forked from kaimu-kun/hastebin.java and edited to use HasteBin fork zneix/haste-server and to create a post from a passed file, instead of a passed string.

Requires Apache commons-io in order to read the passed file to a string and Apache log4j2( SLF4j LOG4J 12 Binding and Apache Log4j SLF4J Binding) for logging. Logging can be replaced by regular ex.printStackTrace(); if you do not want to add any log4j dependencies to your project.

Example:

Hastebin hastebin = new Hastebin();
String hasteBinPost = null;

// Define the file which you want to post to HasteBin
File file = new File("path/to/your/file.txt");

// Create the HasteBin post and store the returned string.
hasteBinPost = hastebin.createHasteBinFromFile(file);

// Print the String containing our URL.
System.out.println(hasteBinPost);