aboutsummaryrefslogtreecommitdiff
path: root/buildScripts/src/lombok/website/CompileChangelog.java
blob: 2508f2378977606ca03a8f9fd7846be0c91f9482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package lombok.website;

import com.petebevin.markdown.MarkdownProcessor;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class CompileChangelog {
	public static void main(String[] args) {
		try {
			FileInputStream in = new FileInputStream(args[0]);
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			byte[] b = new byte[65536];
			while (true) {
				int r = in.read(b);
				if ( r == -1 ) break;
				out.write(b, 0, r);
			}
			in.close();
			String markdown = new String(out.toByteArray(), "UTF-8");
			String html = new MarkdownProcessor().markdown(markdown);
			FileOutputStream file = new FileOutputStream(args[1]);
			file.write(html.getBytes("UTF-8"));
			file.close();
			System.exit(0);
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}