-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize files for java 17 support with 0.04 version
- Loading branch information
Retera
committed
Feb 5, 2022
1 parent
760341b
commit 4e44edc
Showing
282 changed files
with
1,810 additions
and
4,779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
craft3data/src/com/hiveworkshop/wc3/gui/datachooser/JavaJarDataSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.hiveworkshop.wc3.gui.datachooser; | ||
|
||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.ByteBuffer; | ||
import java.nio.file.Files; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
public class JavaJarDataSource implements DataSource { | ||
@Override | ||
public InputStream getResourceAsStream(final String filepath) throws IOException { | ||
return JavaJarDataSource.class.getResourceAsStream("/" + filepath.replace('\\', '/')); | ||
} | ||
|
||
@Override | ||
public File getFile(final String filepath) throws IOException { | ||
final InputStream newInputStream = getResourceAsStream(filepath); | ||
String tmpdir = System.getProperty("java.io.tmpdir"); | ||
if (!tmpdir.endsWith(File.separator)) { | ||
tmpdir += File.separator; | ||
} | ||
final String tempDir = tmpdir + "RMSExtract/"; | ||
final File tempProduct = new File(tempDir + filepath.replace('\\', File.separatorChar)); | ||
tempProduct.delete(); | ||
tempProduct.getParentFile().mkdirs(); | ||
Files.copy(newInputStream, tempProduct.toPath()); | ||
tempProduct.deleteOnExit(); | ||
return tempProduct; | ||
} | ||
|
||
@Override | ||
public ByteBuffer read(final String path) throws IOException { | ||
final InputStream stream = getResourceAsStream(path); | ||
if (stream == null) { | ||
return null; | ||
} | ||
return ByteBuffer.wrap(stream.readAllBytes()); | ||
} | ||
|
||
@Override | ||
public boolean has(final String filepath) { | ||
return JavaJarDataSource.class.getResource("/" + filepath.replace('\\', '/')) != null; | ||
} | ||
|
||
@Override | ||
public boolean allowDownstreamCaching(final String filepath) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Collection<String> getListfile() { | ||
return Collections.emptySet(); // breaks API but not easy from Java and not needed | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
// breaks API but not easy from Java and not needed | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
craft3data/src/com/hiveworkshop/wc3/gui/datachooser/JavaJarDataSourceDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.hiveworkshop.wc3.gui.datachooser; | ||
|
||
public class JavaJarDataSourceDescriptor implements DataSourceDescriptor { | ||
@Override | ||
public DataSource createDataSource() { | ||
return new JavaJarDataSource(); | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "JAR"; | ||
} | ||
|
||
@Override | ||
public DataSourceDescriptor duplicate() { | ||
return this; | ||
} | ||
} |
Oops, something went wrong.