Mercurial > hg4j
comparison src/com/tmate/hgkit/console/Main.java @ 2:08db726a0fb7
Shaping out low-level Hg structures
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sun, 19 Dec 2010 05:41:31 +0100 |
parents | dbd663faec1f |
children | 24bb4f365164 |
comparison
equal
deleted
inserted
replaced
1:a3576694a4d1 | 2:08db726a0fb7 |
---|---|
21 * @author artem | 21 * @author artem |
22 */ | 22 */ |
23 public class Main { | 23 public class Main { |
24 | 24 |
25 public static void main(String[] args) throws Exception { | 25 public static void main(String[] args) throws Exception { |
26 Deflater zip1 = new Deflater(6, true); | |
27 final byte[] input = "Abstractions are valueless".getBytes(); | |
28 zip1.setInput(input); | |
29 zip1.finish(); | |
30 byte[] result1 = new byte[100]; | |
31 int resLen1 = zip1.deflate(result1); | |
32 System.out.printf("%3d:", resLen1); | |
33 for (int i = 0; i < resLen1; i++) { | |
34 System.out.printf("%02X", result1[i]); | |
35 } | |
36 System.out.println(); | |
37 // | |
38 Deflater zip2 = new Deflater(6, false); | |
39 zip2.setInput(input); | |
40 zip2.finish(); | |
41 byte[] result2 = new byte[100]; | |
42 int resLen2 = zip2.deflate(result2); | |
43 System.out.printf("%3d:", resLen2); | |
44 for (int i = 0; i < resLen2; i++) { | |
45 System.out.printf("%02X", result2[i]); | |
46 } | |
47 System.out.println(); | |
48 // | |
49 LinkedList<Changeset> changelog = new LinkedList<Changeset>(); | 26 LinkedList<Changeset> changelog = new LinkedList<Changeset>(); |
50 // | 27 // |
51 DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(new File("/temp/hg/hello/" + ".hg/store/00changelog.i")))); | 28 DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(new File("/temp/hg/hello/" + ".hg/store/00changelog.i")))); |
52 DataInput di = dis; | 29 DataInput di = dis; |
53 dis.mark(10); | 30 dis.mark(10); |