diff options
author | Shevek <[email protected]> | 2015-07-28 17:30:35 -0700 |
---|---|---|
committer | Shevek <[email protected]> | 2015-07-28 17:30:35 -0700 |
commit | 666bfdd30bce3e68fc6cae8aae1383ec4ea43dd5 (patch) | |
tree | c09028ae65a30b58dd61a776417533ea0f495cce | |
parent | 7832018265ee5e369355381dcc170bdbbdfce65a (diff) |
Fix more charset issues.
-rw-r--r-- | src/main/java/org/anarres/cpp/InputLexerSource.java | 2 | ||||
-rw-r--r-- | src/main/java/org/anarres/cpp/ResourceFileSystem.java | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/org/anarres/cpp/InputLexerSource.java b/src/main/java/org/anarres/cpp/InputLexerSource.java index 4f7c03d..62612d7 100644 --- a/src/main/java/org/anarres/cpp/InputLexerSource.java +++ b/src/main/java/org/anarres/cpp/InputLexerSource.java @@ -23,7 +23,7 @@ import java.nio.charset.Charset; import javax.annotation.Nonnull; /** - * A {@link Source} which lexes a file. + * A {@link Source} which lexes an {@link InputStream}. * * The input is buffered. * diff --git a/src/main/java/org/anarres/cpp/ResourceFileSystem.java b/src/main/java/org/anarres/cpp/ResourceFileSystem.java index 7efd664..43d6732 100644 --- a/src/main/java/org/anarres/cpp/ResourceFileSystem.java +++ b/src/main/java/org/anarres/cpp/ResourceFileSystem.java @@ -5,10 +5,9 @@ */ package org.anarres.cpp; -import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; +import java.nio.charset.Charset; import javax.annotation.Nonnull; /** @@ -18,9 +17,11 @@ import javax.annotation.Nonnull; public class ResourceFileSystem implements VirtualFileSystem { private final ClassLoader loader; + private final Charset charset; - public ResourceFileSystem(@Nonnull ClassLoader loader) { + public ResourceFileSystem(@Nonnull ClassLoader loader, @Nonnull Charset charset) { this.loader = loader; + this.charset = charset; } @Override @@ -74,8 +75,7 @@ public class ResourceFileSystem implements VirtualFileSystem { @Override public Source getSource() throws IOException { InputStream stream = loader.getResourceAsStream(path); - BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); - return new LexerSource(reader, true); + return new InputLexerSource(stream, charset); } } } |