01: /*
02: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * [See end of file]
04: */
05:
06: package com.hp.hpl.jena.n3;
07:
08: import java.io.*;
09: import com.hp.hpl.jena.util.FileUtils;
10:
11: //import antlr.collections.AST;
12:
13: /**
14: * @author Andy Seaborne
15: * @version $Id: N3ErrorPrinter.java,v 1.11 2008/01/02 12:04:49 andy_seaborne Exp $
16: */
17: public class N3ErrorPrinter extends NullN3EventHandler {
18: PrintWriter out = null;
19:
20: public N3ErrorPrinter(OutputStream _out) {
21: out = FileUtils.asPrintWriterUTF8(_out);
22: }
23:
24: /** Best not to use a PrintWriter, but use an OutputStreamWriter (buffered)
25: * with charset "UTF-8".
26: */
27:
28: public N3ErrorPrinter(PrintWriter _out) {
29: out = _out;
30: }
31:
32: public void error(Exception ex, String message) {
33: println("Error: " + message);
34: flush();
35: }
36:
37: //public void warning(Exception ex, String message) { println("Warning: "+message) ; }
38: //public void deprecated(Exception ex, String message) { println("Deprecated: "+message) ; }
39:
40: private void print(String s) {
41: out.print(s);
42: }
43:
44: private void println(String s) {
45: out.println();
46: }
47:
48: private void println() {
49: out.println();
50: }
51:
52: private void flush() {
53: out.flush();
54: }
55: }
56:
57: /*
58: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
59: * All rights reserved.
60: *
61: * Redistribution and use in source and binary forms, with or without
62: * modification, are permitted provided that the following conditions
63: * are met:
64: * 1. Redistributions of source code must retain the above copyright
65: * notice, this list of conditions and the following disclaimer.
66: * 2. Redistributions in binary form must reproduce the above copyright
67: * notice, this list of conditions and the following disclaimer in the
68: * documentation and/or other materials provided with the distribution.
69: * 3. The name of the author may not be used to endorse or promote products
70: * derived from this software without specific prior written permission.
71: *
72: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
73: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
74: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
75: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
76: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
77: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
78: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
79: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
80: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
81: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
82: */
|