|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
FileCharStream.java | 0% | 0% | 0% | 0% |
|
1 |
package org.codehaus.groovy.syntax.lexer;
|
|
2 |
|
|
3 |
import java.io.File;
|
|
4 |
import java.io.IOException;
|
|
5 |
import java.io.FileInputStream;
|
|
6 |
import org.codehaus.groovy.syntax.ReadException;
|
|
7 |
|
|
8 |
public class FileCharStream |
|
9 |
implements CharStream
|
|
10 |
{ |
|
11 |
private File file;
|
|
12 |
private CharStream charStream;
|
|
13 |
|
|
14 | 0 |
public FileCharStream(File file)
|
15 |
{ |
|
16 | 0 |
this.file = file;
|
17 |
} |
|
18 |
|
|
19 | 0 |
public File getFile()
|
20 |
{ |
|
21 | 0 |
return this.file; |
22 |
} |
|
23 |
|
|
24 | 0 |
protected CharStream getCharStream()
|
25 |
throws ReadException
|
|
26 |
{ |
|
27 | 0 |
try
|
28 |
{ |
|
29 | 0 |
if ( this.charStream == null ) |
30 |
{ |
|
31 | 0 |
this.charStream = new InputStreamCharStream( new FileInputStream( getFile() ) ); |
32 |
} |
|
33 |
} |
|
34 |
catch( IOException e )
|
|
35 |
{ |
|
36 | 0 |
throw new ReadException( e ); |
37 |
} |
|
38 |
|
|
39 | 0 |
return this.charStream; |
40 |
} |
|
41 |
|
|
42 | 0 |
public String getDescription()
|
43 |
{ |
|
44 | 0 |
return getFile().getPath();
|
45 |
} |
|
46 |
|
|
47 | 0 |
public char consume() |
48 |
throws ReadException
|
|
49 |
{ |
|
50 | 0 |
return getCharStream().consume();
|
51 |
} |
|
52 |
|
|
53 | 0 |
public void close() |
54 |
throws ReadException
|
|
55 |
{ |
|
56 | 0 |
getCharStream().close(); |
57 |
} |
|
58 |
} |
|
59 |
|
|