aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShevek <[email protected]>2015-07-28 17:30:35 -0700
committerShevek <[email protected]>2015-07-28 17:30:35 -0700
commit666bfdd30bce3e68fc6cae8aae1383ec4ea43dd5 (patch)
treec09028ae65a30b58dd61a776417533ea0f495cce
parent7832018265ee5e369355381dcc170bdbbdfce65a (diff)
Fix more charset issues.
-rw-r--r--src/main/java/org/anarres/cpp/InputLexerSource.java2
-rw-r--r--src/main/java/org/anarres/cpp/ResourceFileSystem.java10
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);
}
}
}