mirror of
https://github.com/quinton-ashley/java2js
synced 2024-12-29 10:11:54 +01:00
1.2.7
This commit is contained in:
parent
ab8675e241
commit
f122d89264
@ -1,4 +1,9 @@
|
|||||||
jdk.imports['java.io.FileNotFoundException'].load = async () => {
|
jdk.imports['java.io.FileNotFoundException'].load = async () => {
|
||||||
class FileNotFoundException {}
|
class FileNotFoundException extends Exception {
|
||||||
|
constructor(msg) {
|
||||||
|
super(msg);
|
||||||
|
this.name = 'FileNotFoundException';
|
||||||
|
}
|
||||||
|
}
|
||||||
jdk.java.io.FileNotFoundException = FileNotFoundException;
|
jdk.java.io.FileNotFoundException = FileNotFoundException;
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
jdk.imports['java.util.Scanner'].load = async () => {
|
jdk.imports['java.util.Scanner'].load = async () => {
|
||||||
const InputStream = await jdk.import('java.io.InputStream');
|
const InputStream = await jdk.import('java.io.InputStream');
|
||||||
|
const FileNotFoundException = await jdk.import('java.io.FileNotFoundException');
|
||||||
|
|
||||||
class Scanner {
|
class Scanner {
|
||||||
constructor(input) {
|
constructor(input) {
|
||||||
@ -12,7 +13,11 @@ jdk.imports['java.util.Scanner'].load = async () => {
|
|||||||
}
|
}
|
||||||
async _loadFile(filePath) {
|
async _loadFile(filePath) {
|
||||||
this.in = new InputStream();
|
this.in = new InputStream();
|
||||||
this.in.stream = await (await fetch(filePath)).text();
|
let data = await fetch(filePath);
|
||||||
|
if (data.status == 404 || data.status == 403) {
|
||||||
|
throw new FileNotFoundException(filePath);
|
||||||
|
}
|
||||||
|
this.in.stream = await data.text();
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
}
|
}
|
||||||
async hasNext(pattern) {
|
async hasNext(pattern) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "java2js",
|
"name": "java2js",
|
||||||
"version": "1.2.6",
|
"version": "1.2.7",
|
||||||
"description": "Converts Java to JavaScript and runs it with a JS JDK",
|
"description": "Converts Java to JavaScript and runs it with a JS JDK",
|
||||||
"main": "jdk.js",
|
"main": "jdk.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user