diff options
author | Shevek <[email protected]> | 2015-07-28 17:27:44 -0700 |
---|---|---|
committer | Shevek <[email protected]> | 2015-07-28 17:27:44 -0700 |
commit | 7832018265ee5e369355381dcc170bdbbdfce65a (patch) | |
tree | d73554c05a0fd5a6f13b7dce9f33560f2e30800b /src/main/java/org/anarres/cpp/InputLexerSource.java | |
parent | 6b418b25fbf2b15de1df5d2b5409adf847cefde0 (diff) |
Fix some findbugs warnings.
Diffstat (limited to 'src/main/java/org/anarres/cpp/InputLexerSource.java')
-rw-r--r-- | src/main/java/org/anarres/cpp/InputLexerSource.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/org/anarres/cpp/InputLexerSource.java b/src/main/java/org/anarres/cpp/InputLexerSource.java index 1e5b410..4f7c03d 100644 --- a/src/main/java/org/anarres/cpp/InputLexerSource.java +++ b/src/main/java/org/anarres/cpp/InputLexerSource.java @@ -16,10 +16,11 @@ */ package org.anarres.cpp; -import java.io.BufferedReader; -import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.Charset; +import javax.annotation.Nonnull; /** * A {@link Source} which lexes a file. @@ -30,21 +31,22 @@ import java.io.InputStreamReader; */ public class InputLexerSource extends LexerSource { + @Deprecated + public InputLexerSource(@Nonnull InputStream input) { + this(input, Charset.defaultCharset()); + } + /** * Creates a new Source for lexing the given Reader. * * Preprocessor directives are honoured within the file. */ - public InputLexerSource(InputStream input) - throws IOException { - super( - new BufferedReader( - new InputStreamReader( - input - ) - ), - true - ); + public InputLexerSource(@Nonnull InputStream input, Charset charset) { + this(new InputStreamReader(input, charset)); + } + + public InputLexerSource(@Nonnull Reader input) { + super(toBufferedReader(input), true); } @Override |