Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Griefed 2597d49f5e Merge branch 'renovate-org.apache.logging.log4j-log4j-slf4j-impl-2.x' into 'master'
fix(deps): update dependency org.apache.logging.log4j:log4j-slf4j-impl to v2.22.0

See merge request Griefed/hastebin-java!117
2024-02-14 17:52:54 +01:00
.github/workflows chore(deps): update actions/setup-java action to v4 2023-12-04 11:41:42 +00:00
.gitlab/issue_templates chore: Add GitLab issue templates 2021-07-14 16:30:20 +02:00
.idea Add docs 2021-05-03 09:25:05 +02:00
build Add docs 2021-05-03 09:25:05 +02:00
gradle/wrapper chore(deps): update dependency gradle to v8.2 2023-07-04 10:45:15 +00:00
src Add docs 2021-05-03 09:25:05 +02:00
.gitignore chore: Add .gradle to gitignore and delete no longer needed files 2021-07-14 17:19:16 +02:00
.gitlab-ci.yml chore(deps): update docker.griefed.dev/griefed/baseimage-ubuntu-jdk-8 docker tag to v2.0.26 2023-12-04 11:40:24 +00:00
build.gradle Merge branch 'master' into 'renovate-org.apache.logging.log4j-log4j-slf4j-impl-2.x' 2024-02-14 17:50:12 +01:00
gradlew chore(deps): update dependency gradle to v8.2 2023-07-04 10:45:15 +00:00
gradlew.bat chore(deps): update dependency gradle to v7.6 2023-01-04 11:39:16 +00:00
LICENSE.txt Added LICENSE.txt 2019-09-01 13:36:09 +02:00
README.md Update README.md 2021-06-25 10:46:12 +00:00
renovate.json Update renovate.json 2021-12-17 18:47:38 +01:00
settings.gradle Move to gradle 2021-05-03 08:58:44 +02:00
test.txt Move to gradle 2021-05-03 08:58:44 +02:00

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);