Add support for non-file jar mapping reading
The input is now a BufferedReader, so you can read from a file with new BufferedReader(new FileReader(...)), or from an input stream with new BufferedReader(new InputStreamReader(...)).
This commit is contained in:
parent
37ce7f0b37
commit
769c398dd5
@ -42,21 +42,15 @@ public class JarMapping {
|
||||
|
||||
}
|
||||
|
||||
public JarMapping(File file) throws IOException {
|
||||
this(file, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a mapping given a .csrg file
|
||||
*
|
||||
* @param file Mapping file
|
||||
* @param reader Mapping file reader
|
||||
* @param shader Relocation to apply to old class names, or null for no
|
||||
* relocation
|
||||
* @throws IOException
|
||||
*/
|
||||
public JarMapping(File file, ShadeRelocationSimulator shader) throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
|
||||
public JarMapping(BufferedReader reader, ShadeRelocationSimulator shader) throws IOException {
|
||||
if (shader == null) {
|
||||
shader = ShadeRelocationSimulator.IDENTITY;
|
||||
}
|
||||
|
@ -28,7 +28,9 @@
|
||||
*/
|
||||
package net.md_5.specialsource;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -132,7 +134,8 @@ public class SpecialSource {
|
||||
}
|
||||
|
||||
log("Loading mappings");
|
||||
jarMapping = new JarMapping((File) options.valueOf("srg-in"), shadeRelocationSimulator);
|
||||
BufferedReader reader = new BufferedReader(new FileReader((File) options.valueOf("srg-in")));
|
||||
jarMapping = new JarMapping(reader, shadeRelocationSimulator);
|
||||
} else {
|
||||
System.err.println("No mappings given, first-jar/second-jar or srg-in required");
|
||||
parser.printHelpOn(System.err);
|
||||
|
Loading…
Reference in New Issue
Block a user