Added Author Tag
If this is incorrect please feel free to update it or adjust
This commit is contained in:
parent
fb075c884b
commit
f5c7cd7496
|
@ -24,20 +24,23 @@ import java.util.stream.Stream;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Robert Grosse (Storyyeller)
|
||||||
|
* @since 10/01/2017
|
||||||
|
*/
|
||||||
public class JRTExtractor
|
public class JRTExtractor
|
||||||
{
|
{
|
||||||
public static void extractRT(String path) throws Throwable
|
public static void extractRT(String path) throws Throwable
|
||||||
{
|
{
|
||||||
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
|
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
|
||||||
|
|
||||||
try (ZipOutputStream zipStream = new ZipOutputStream(Files.newOutputStream(Paths.get(path))); Stream<Path> stream = Files.walk(fs.getPath("/")))
|
try (ZipOutputStream zipStream = new ZipOutputStream(Files.newOutputStream(Paths.get(path)));
|
||||||
|
Stream<Path> stream = Files.walk(fs.getPath("/")))
|
||||||
{
|
{
|
||||||
stream.forEach(p ->
|
stream.forEach(p ->
|
||||||
{
|
{
|
||||||
if (!Files.isRegularFile(p))
|
if (!Files.isRegularFile(p))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -48,9 +51,7 @@ public class JRTExtractor
|
||||||
assert list.remove(0).equals("modules");
|
assert list.remove(0).equals("modules");
|
||||||
|
|
||||||
if (!list.get(list.size() - 1).equals("module-info.class"))
|
if (!list.get(list.size() - 1).equals("module-info.class"))
|
||||||
{
|
|
||||||
list.remove(0);
|
list.remove(0);
|
||||||
}
|
|
||||||
|
|
||||||
list.remove(0);
|
list.remove(0);
|
||||||
String outPath = String.join("/", list);
|
String outPath = String.join("/", list);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user