diff options
author | Sven Gothel <[email protected]> | 2023-08-08 11:08:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-08 11:08:16 +0200 |
commit | e33d67ee14f6a5b999564b40ac0c659db92f2ce0 (patch) | |
tree | 2a314eb52ffc21f885e9bf42562234a9b93bdeea /src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java | |
parent | 00f97cc623469377c59985898b9b765ae66c0aee (diff) | |
parent | 5e50e75ec33f5b4567cabfd60b6baca39524a8b7 (diff) |
Merge remote-tracking branch 'upstream/master' into pulled
# Conflicts:
# build.gradle
# gradle.properties
# gradle/wrapper/gradle-wrapper.jar
# gradle/wrapper/gradle-wrapper.properties
# gradlew
# gradlew.bat
# src/main/java/com/jogamp/gluegen/jcpp/MacroTokenSource.java
# src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java
# src/main/java/com/jogamp/gluegen/jcpp/SourceIterator.java
# src/main/java/org/anarres/cpp/Main.java
# src/test/java/com/jogamp/gluegen/jcpp/PragmaTest.java
# src/test/java/com/jogamp/gluegen/jcpp/RegressionTest.java
# src/test/java/com/jogamp/gluegen/jcpp/VaArgsPastingTest.java
Diffstat (limited to 'src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java')
-rw-r--r-- | src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java b/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java index 6d7e4c5..01fdbd1 100644 --- a/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java +++ b/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java @@ -1,6 +1,6 @@ /* * Anarres C Preprocessor - * Copyright (c) 2007-2008, Shevek + * Copyright (c) 2007-2015, Shevek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,10 @@ package com.jogamp.gluegen.jcpp; import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; +import java.nio.charset.Charset; import javax.annotation.Nonnull; /** @@ -29,7 +31,7 @@ import javax.annotation.Nonnull; * * @see Source */ -public class FileLexerSource extends LexerSource { +public class FileLexerSource extends InputLexerSource { private final String path; private final File file; @@ -39,29 +41,38 @@ public class FileLexerSource extends LexerSource { * * Preprocessor directives are honoured within the file. */ - public FileLexerSource(@Nonnull File file, String path) + public FileLexerSource(@Nonnull File file, @Nonnull Charset charset, @Nonnull String path) throws IOException { - super( - new BufferedReader( - new FileReader( - file - ) - ), - true - ); - + super(new FileInputStream(file), charset); this.file = file; this.path = path; } + public FileLexerSource(@Nonnull File file, @Nonnull String path) + throws IOException { + this(file, Charset.defaultCharset(), path); + } + + public FileLexerSource(@Nonnull File file, @Nonnull Charset charset) + throws IOException { + this(file, charset, file.getPath()); + } + + @Deprecated public FileLexerSource(@Nonnull File file) throws IOException { - this(file, file.getPath()); + this(file, Charset.defaultCharset()); + } + + public FileLexerSource(@Nonnull String path, @Nonnull Charset charset) + throws IOException { + this(new File(path), charset, path); } + @Deprecated public FileLexerSource(@Nonnull String path) throws IOException { - this(new File(path), path); + this(path, Charset.defaultCharset()); } @Nonnull |