sync with jwo
This commit is contained in:
22
build.gradle
22
build.gradle
@@ -1,12 +1,19 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
|
id 'net.woggioni.gradle.lombok' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: 'java-library'
|
apply plugin: 'java-library'
|
||||||
|
apply plugin: 'net.woggioni.gradle.lombok'
|
||||||
|
|
||||||
group = "net.woggioni"
|
group = "net.woggioni"
|
||||||
version = getProperty('version.wson')
|
version = getProperty('version.wson')
|
||||||
|
|
||||||
|
lombok {
|
||||||
|
version = getProperty('version.lombok')
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = "https://woggioni.net/mvn/"
|
url = "https://woggioni.net/mvn/"
|
||||||
@@ -47,21 +54,14 @@ dependencies {
|
|||||||
testImplementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: getProperty('version.jackson')
|
testImplementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: getProperty('version.jackson')
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
java {
|
||||||
options.release = 8
|
withJavadocJar()
|
||||||
}
|
withSourcesJar()
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest{
|
|
||||||
attributes([
|
|
||||||
"Automatic-Module-Name": "net.woggioni.wson"
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper {
|
wrapper {
|
||||||
distributionType = Wrapper.DistributionType.BIN
|
distributionType = Wrapper.DistributionType.BIN
|
||||||
gradleVersion = "7.0.2"
|
gradleVersion = getProperty("version.gradle")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
version.gradle=7.1.1
|
||||||
version.wson = 1.0
|
version.wson = 1.0
|
||||||
version.jwo = 1.0
|
version.jwo = 1.0
|
||||||
version.junit.jupiter = 5.7.0
|
version.junit.jupiter = 5.7.0
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
maven {
|
||||||
|
url = 'https://woggioni.net/mvn/'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
id "net.woggioni.gradle.executable.jar" version "0.1"
|
||||||
|
id "net.woggioni.gradle.lombok" version "0.1"
|
||||||
id 'org.jetbrains.kotlin.jvm' version getProperty('version.kotlin')
|
id 'org.jetbrains.kotlin.jvm' version getProperty('version.kotlin')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,39 +0,0 @@
|
|||||||
package net.woggioni.wson.buffer;
|
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
public class LookAheadInputStream extends InputStream {
|
|
||||||
|
|
||||||
private final byte[] buffer = new byte[1024];
|
|
||||||
private final InputStream stream;
|
|
||||||
private int bufferFill = -1;
|
|
||||||
private int cursor = -1;
|
|
||||||
private int currentByte;
|
|
||||||
|
|
||||||
public LookAheadInputStream(InputStream stream) {
|
|
||||||
this.stream = stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SneakyThrows
|
|
||||||
public int read() {
|
|
||||||
if (cursor > bufferFill) {
|
|
||||||
return -1;
|
|
||||||
} else if (cursor == bufferFill) {
|
|
||||||
do {
|
|
||||||
bufferFill = stream.read(buffer, 0, buffer.length) - 1;
|
|
||||||
cursor = 0;
|
|
||||||
} while(bufferFill == -1);
|
|
||||||
currentByte = bufferFill == -2 ? -1 : Math.floorMod(buffer[0], 256);
|
|
||||||
} else {
|
|
||||||
currentByte = Math.floorMod(buffer[++cursor], 256);
|
|
||||||
}
|
|
||||||
return currentByte;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrentByte() {
|
|
||||||
return currentByte;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,41 +0,0 @@
|
|||||||
package net.woggioni.wson.buffer;
|
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.Reader;
|
|
||||||
|
|
||||||
public class LookAheadTextInputStream extends InputStream {
|
|
||||||
|
|
||||||
private final char[] buffer = new char[1024];
|
|
||||||
private final Reader reader;
|
|
||||||
private int bufferFill = -1;
|
|
||||||
private int cursor = -1;
|
|
||||||
private int currentChar;
|
|
||||||
|
|
||||||
|
|
||||||
public LookAheadTextInputStream(Reader reader) {
|
|
||||||
this.reader = reader;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SneakyThrows
|
|
||||||
public int read() {
|
|
||||||
if (cursor > bufferFill) {
|
|
||||||
return -1;
|
|
||||||
} else if (cursor == bufferFill) {
|
|
||||||
do {
|
|
||||||
bufferFill = reader.read(buffer, 0, buffer.length) - 1;
|
|
||||||
cursor = 0;
|
|
||||||
} while(bufferFill == -1);
|
|
||||||
currentChar = bufferFill == -2 ? -1 : buffer[0];
|
|
||||||
} else {
|
|
||||||
currentChar = buffer[++cursor];
|
|
||||||
}
|
|
||||||
return currentChar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrentByte() {
|
|
||||||
return currentChar;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,7 +2,7 @@ package net.woggioni.wson.serialization.binary;
|
|||||||
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.woggioni.jwo.Leb128;
|
import net.woggioni.jwo.Leb128;
|
||||||
import net.woggioni.wson.buffer.LookAheadInputStream;
|
import net.woggioni.jwo.LookAheadInputStream;
|
||||||
import net.woggioni.wson.exception.ParseException;
|
import net.woggioni.wson.exception.ParseException;
|
||||||
import net.woggioni.wson.serialization.ValueParser;
|
import net.woggioni.wson.serialization.ValueParser;
|
||||||
import net.woggioni.wson.xface.Parser;
|
import net.woggioni.wson.xface.Parser;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package net.woggioni.wson.serialization.json;
|
package net.woggioni.wson.serialization.json;
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.woggioni.wson.buffer.LookAheadTextInputStream;
|
import net.woggioni.jwo.LookAheadTextInputStream;
|
||||||
import net.woggioni.wson.exception.IOException;
|
import net.woggioni.wson.exception.IOException;
|
||||||
import net.woggioni.wson.exception.NotImplementedException;
|
import net.woggioni.wson.exception.NotImplementedException;
|
||||||
import net.woggioni.wson.exception.ParseException;
|
import net.woggioni.wson.exception.ParseException;
|
||||||
|
5
src/main/java9/module-info.java
Normal file
5
src/main/java9/module-info.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module net.woggioni.wson {
|
||||||
|
exports net.woggioni.wson.xface;
|
||||||
|
exports net.woggioni.wson.value;
|
||||||
|
exports net.woggioni.wson.exception;
|
||||||
|
}
|
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.JsonNodeType;
|
import com.fasterxml.jackson.databind.node.JsonNodeType;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.woggioni.wson.buffer.LookAheadTextInputStream;
|
import net.woggioni.jwo.LookAheadTextInputStream;
|
||||||
import net.woggioni.wson.exception.NotImplementedException;
|
import net.woggioni.wson.exception.NotImplementedException;
|
||||||
import net.woggioni.wson.value.ArrayValue;
|
import net.woggioni.wson.value.ArrayValue;
|
||||||
import net.woggioni.wson.value.ObjectValue;
|
import net.woggioni.wson.value.ObjectValue;
|
||||||
|
@@ -2,9 +2,9 @@ package net.woggioni.wson.traversal;
|
|||||||
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.woggioni.jwo.JWO;
|
import net.woggioni.jwo.JWO;
|
||||||
|
import net.woggioni.jwo.Tuple2;
|
||||||
import net.woggioni.wson.serialization.json.JSONParser;
|
import net.woggioni.wson.serialization.json.JSONParser;
|
||||||
import net.woggioni.wson.serialization.json.JSONTest;
|
import net.woggioni.wson.serialization.json.JSONTest;
|
||||||
import net.woggioni.jwo.tuple.Tuple2;
|
|
||||||
import net.woggioni.wson.value.ArrayValue;
|
import net.woggioni.wson.value.ArrayValue;
|
||||||
import net.woggioni.wson.value.ObjectValue;
|
import net.woggioni.wson.value.ObjectValue;
|
||||||
import net.woggioni.wson.xface.Parser;
|
import net.woggioni.wson.xface.Parser;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package net.woggioni.wson.value;
|
package net.woggioni.wson.value;
|
||||||
|
|
||||||
import net.woggioni.jwo.tuple.Tuple2;
|
import net.woggioni.jwo.Tuple2;
|
||||||
import net.woggioni.wson.xface.Value;
|
import net.woggioni.wson.xface.Value;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
Reference in New Issue
Block a user