https://github.com/vmj/slacklog-java
Java bindings for Python slacklog module
https://github.com/vmj/slacklog-java
changelog feed generator java slackware
Last synced: 25 days ago
JSON representation
Java bindings for Python slacklog module
- Host: GitHub
- URL: https://github.com/vmj/slacklog-java
- Owner: vmj
- License: gpl-3.0
- Created: 2017-08-20T21:58:00.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-03-15T22:54:14.000Z (over 7 years ago)
- Last Synced: 2025-01-17T22:21:34.692Z (over 1 year ago)
- Topics: changelog, feed, generator, java, slackware
- Language: Java
- Size: 197 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.txt
Awesome Lists containing this project
README
= Slacklog Java
Java wrapper for Python https://pypi.python.org/pypi/slacklog[slacklog] module.
slacklog-java provides a library to convert a Slackware ChangeLog into other formats.
Currently, RSS, Atom, JSON and PyBlosxom formats are supported.
* Source code: https://github.com/vmj/slacklog-java
* Builds status: https://travis-ci.org/vmj/slacklog-java
* Docs: https://www.javadoc.io/doc/fi.linuxbox.slacklog/slacklog-java
== Example usage
[source,java]
----
import fi.linuxbox.slacklog.formatters.SlackLogJsonFormatter;
import fi.linuxbox.slacklog.models.SlackLog;
import fi.linuxbox.slacklog.parsers.SlackLogParser;
import org.python.core.Py;
import org.python.core.PySystemState;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_8;
public class Example {
public static void main(String... args) throws IOException {
// Initialize Jython
PySystemState.initialize();
// Read the source ChangeLog.txt
final String changelog = read("src/test/resources/ChangeLog.txt", ISO_8859_1);
// Parse the ChangeLog.txt
final SlackLog slacklog = new SlackLogParser().parse(changelog);
// Convert the ChangeLog to JSON
final SlackLogJsonFormatter formatter = new SlackLogJsonFormatter();
formatter.setIndent(4);
final String json = formatter.format(slacklog);
// Write the output
write("src/test/resources/ChangeLog.json", json.getBytes(UTF_8));
// Close the resources
Py.getSystemState().close();
}
private static String read(final String path, final Charset charset) throws IOException {
return new String(Files.readAllBytes(Paths.get(path)), charset);
}
private static void write(final String path, final byte[] data) throws IOException {
Files.write(Paths.get(path), data);
}
}
----
== Requirements
Slacklog Java requires Java 8. This library is available at
http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22fi.linuxbox.slacklog%22[The Central Repository] and
https://bintray.com/search?sort=last_updated&query=fi.linuxbox.slacklog[jcenter]
== Authors
Original author and current maintainer is Mikko Värri (vmj@linuxbox.fi).
== License
slacklog-java is Free Software, licensed under GNU General Public License
(GPL), version 3 or later. See LICENSE.txt file for details.