Download this file

Help.java    131 lines (120 with data), 4.4 kB

  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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package cologne.eck.tools;
import java.io.File;
import java.util.ArrayList;
import java.util.Set;
import java.util.TreeMap;
/*
* Peafactory - Production of Password Encryption Archives
* Copyright (C) 2015 Axel von dem Bruch
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* See: http://www.gnu.org/licenses/gpl-2.0.html
* You should have received a copy of the GNU General Public License
* along with this library.
*/
public class Help {
public final static void printBytes (String comment, byte[] input) {
System.out.println("\n" + comment + ": ");
for (int i = 0; i<input.length; i++) {
if (i > 0 &&i % 32 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printBytes (String comment, byte[] input, int begin, int end) {
System.out.println("\n" + comment + ": "+begin+"-"+end);
for (int i = begin; i<end; i++) {
if (i > 0 &&i % 32 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printlastBytes (String comment, byte[] input) {
System.out.println("\n" + comment);
for (int i = input.length - 32; i<input.length; i++) {
if (i > 0 &&i % 32 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printlastBytes (String comment, byte[] input, int length) {
System.out.println("\n" + comment);
for (int i = input.length - length; i<input.length; i++) {
if (i > 0 &&i % 32 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printfirstBytes (String comment, byte[] input) {
System.out.println("\n" + comment);
for (int i = 0; i<32; i++) {
if (i > 0 &&i % 32 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printInts (String comment, int[] input) {
System.out.println("\n" + comment + ": ");
for (int i = 0; i<input.length; i++) {
if (i > 0 && i % 16 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printLongs (String comment, long[] input) {
System.out.println("\n" + comment + ": ");
for (int i = 0; i<input.length; i++) {
if (i > 0 && i % 16 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printLongs (String comment, long[] input, int begin, int end) {
System.out.println("\n" + comment + ": ");
for (int i = begin; i<end; i++) {
if (i > 0 && i % 16 == 0) System.out.println("");
System.out.print(" " + input[i]);
}
System.out.println("");
}
public final static void printStringArray(String comment, String[] input) {
System.out.println("\n" + comment + ": ");
if (input == null) return;
for (int i = 0; i<input.length; i++) {
System.out.println(input[i]);
}
System.out.println("");
}
public final static void printFileArray(String comment, File[] input) {
System.out.println("\n" + comment + ": ");
if (input == null) return;
for (int i = 0; i<input.length; i++) {
System.out.println(input[i].getAbsolutePath());
}
System.out.println("");
}
public final static void printStringList(String comment, ArrayList<String> list) {
System.out.println("\n" + comment + ": ");
int len = list.size();
for (int i = 0; i < len; i++){
System.out.println(list.get(i));
}
}
public final static void printTreeMapKeys(String comment, TreeMap <File, String> map) {
if (map == null) return;
Set<File> col = map.keySet();
File[] keys = col.toArray(new File [0]);
System.out.println("\n" + comment + ": ");
for (int i = 0; i < keys.length; i++) {
System.out.println(keys[i].getAbsolutePath());
}
System.out.println("");
}
}