##### Coverage Report - org.webmacro.engine.TextParser

Classes in this File | Line Coverage | Branch Coverage | Complexity
TextParser |
0% | 0/10
0% | 0/2
| 1.5;1.5

1 |  |
     /*
2 |  |
      * Copyright (C) 1998-2000 Semiotek Inc.  All Rights Reserved.
3 |  |
      *
4 |  |
      * Redistribution and use in source and binary forms, with or without
5 |  |
      * modification, are permitted under the terms of either of the following
6 |  |
      * Open Source licenses:
7 |  |
      *
8 |  |
      * The GNU General Public License, version 2, or any later version, as
9 |  |
      * published by the Free Software Foundation
10 |  |
      * (http://www.fsf.org/copyleft/gpl.html);
11 |  |
      *
12 |  |
      *  or
13 |  |
      *
14 |  |
      * The Semiotek Public License (http://webmacro.org/LICENSE.)
15 |  |
      *
16 |  |
      * This software is provided "as is", with NO WARRANTY, not even the
17 |  |
      * implied warranties of fitness to purpose, or merchantability. You
18 |  |
      * assume all risks and liabilities associated with its use.
19 |  |
      *
20 |  |
      * See www.webmacro.org for more information on the WebMacro project.
21 |  |
      */
22 |  |
23 |  |
24 |  |
     package org.webmacro.engine;
25 |  |
26 |  |
     import org.webmacro.Broker;
27 |  |
28 |  |
     import java.io.IOException;
29 |  |
     import java.io.Reader;
30 |  |
31 |  |
     /**
32 |  |
      * This parser returns all the input as is
33 |  |
      */
34 |  |
     public class TextParser implements Parser
35 |  |
     {
36 |  |
37 |  |
         public TextParser (Broker broker)
38 | 0 |
         {
39 | 0 |
         }
40 |  |
41 |  |
         public BlockBuilder parseBlock (String name, Reader in)
42 |  |
                 throws ParseException, IOException
43 |  |
         {
44 | 0 |
             BlockBuilder bb = new BlockBuilder();
45 | 0 |
             char buf[] = new char[512];
46 | 0 |
             StringBuffer sb = new StringBuffer(512);
47 |  |
             int num;
48 | 0 |
             while ((num = in.read(buf)) != -1)
49 |  |
             {
50 | 0 |
                 sb.append(buf, 0, num);
51 |  |
             }
52 | 0 |
             bb.addElement(sb.toString());
53 | 0 |
             in.close();
54 | 0 |
             return bb;
55 |  |
         }
56 |  |
     }
57 |  |
58 |  |