KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > n3 > N3ErrorPrinter


1 /*
2  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5
6 package com.hp.hpl.jena.n3;
7 import java.io.*;
8 import com.hp.hpl.jena.util.FileUtils ;
9 //import antlr.collections.AST;
10

11
12 /**
13  * @author Andy Seaborne
14  * @version $Id: N3ErrorPrinter.java,v 1.8 2005/02/21 12:04:04 andy_seaborne Exp $
15  */

16 public class N3ErrorPrinter extends NullN3EventHandler
17 {
18     PrintWriter out = null;
19     
20     public N3ErrorPrinter(OutputStream _out)
21     {
22         out = FileUtils.asPrintWriterUTF8(_out) ;
23     }
24     
25     /** Best not to use a PrintWriter, but use an OutputStreamWriter (buffered)
26      * with charset "UTF-8".
27      */

28     
29     public N3ErrorPrinter(PrintWriter _out)
30     {
31         out = _out;
32     }
33
34     public void error(Exception JavaDoc ex, String JavaDoc message) { println("Error: "+message) ; flush() ; }
35     //public void warning(Exception ex, String message) { println("Warning: "+message) ; }
36
//public void deprecated(Exception ex, String message) { println("Deprecated: "+message) ; }
37

38     private void print(String JavaDoc s) { out.print(s) ; }
39     private void println(String JavaDoc s) { out.println() ; }
40     private void println() { out.println() ; }
41     private void flush() { out.flush() ; }
42 }
43
44 /*
45  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
46  * All rights reserved.
47  *
48  * Redistribution and use in source and binary forms, with or without
49  * modification, are permitted provided that the following conditions
50  * are met:
51  * 1. Redistributions of source code must retain the above copyright
52  * notice, this list of conditions and the following disclaimer.
53  * 2. Redistributions in binary form must reproduce the above copyright
54  * notice, this list of conditions and the following disclaimer in the
55  * documentation and/or other materials provided with the distribution.
56  * 3. The name of the author may not be used to endorse or promote products
57  * derived from this software without specific prior written permission.
58  *
59  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
60  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
61  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
62  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
63  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
65  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
66  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
67  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
68  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69  */

70
Popular Tags