-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathIErr.java
90 lines (68 loc) · 3.19 KB
/
IErr.java
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
/*---
iGeo - http://igeo.jp
Copyright (c) 2002-2013 Satoru Sugihara
This file is part of iGeo.
iGeo is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, version 3.
iGeo 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with iGeo. If not, see <http://www.gnu.org/licenses/>.
---*/
package igeo;
import java.io.*;
/**
A class to provide default static error output stream.
@see IOut
@author Satoru Sugihara
*/
public class IErr {
public static PrintStream ps = System.err;
public static boolean printPrefix=true; //false;
public static boolean enabled=true; //false; //true;
public static String errPrefix = "ERROR: ";
public static void setStream(PrintStream pstr){ ps=pstr; }
public static void enablePrefix(){ printPrefix=true; }
public static void disablePrefix(){ printPrefix=false; }
public static void enablePrint(){ enabled=true; }
public static void disablePrint(){ enabled=false; }
public static void p(Object str){
if(enabled){
if(printPrefix) IOut.printCurrentStack(ps);
ps.print(errPrefix);
ps.println(str);
}
}
public static void p(){
if(enabled){
if(printPrefix) IOut.printCurrentStack(ps); // added
ps.print(errPrefix);
ps.println();
}
}
public static void printStack(){ if(enabled) IOut.printStack(ps); }
public static void println(Object str){ if(enabled) ps.println(str); }
public static void println(boolean str){ if(enabled) ps.println(str); }
public static void println(char str){ if(enabled) ps.println(str); }
public static void println(char[] str){ if(enabled) ps.println(str); }
public static void println(double str){ if(enabled) ps.println(str); }
public static void println(float str){ if(enabled) ps.println(str); }
public static void println(int str){ if(enabled) ps.println(str); }
public static void println(long str){ if(enabled) ps.println(str); }
public static void println(String str){ if(enabled) ps.println(str); }
public static void println(){ if(enabled) ps.println(); }
public static void print(Object str){ if(enabled) ps.print(str); }
public static void print(boolean str){ if(enabled) ps.print(str); }
public static void print(char str){ if(enabled) ps.print(str); }
public static void print(char[] str){ if(enabled) ps.print(str); }
public static void print(double str){ if(enabled) ps.print(str); }
public static void print(float str){ if(enabled) ps.print(str); }
public static void print(int str){ if(enabled) ps.print(str); }
public static void print(long str){ if(enabled) ps.print(str); }
public static void print(String str){ if(enabled) ps.print(str); }
public static void flush(){ if(enabled) ps.flush(); }
public static PrintStream get(){ return ps; }
}