Skip to content

Commit

Permalink
Replace jakarta dependency with java.util.Base64
Browse files Browse the repository at this point in the history
  • Loading branch information
tordanik committed Oct 1, 2024
1 parent dac4207 commit 66946c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,6 @@
<version>1.0.6</version>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.2</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
Expand All @@ -30,8 +31,6 @@
import org.osm2world.core.util.Resolution;
import org.osm2world.core.util.color.LColor;

import jakarta.xml.bind.DatatypeConverter;

/**
* a texture with metadata necessary for calculating texture coordinates.
*/
Expand Down Expand Up @@ -125,7 +124,7 @@ public String getDataUri() {
RasterImageFormat format = getRasterImageFormat();
try (var stream = new ByteArrayOutputStream()) {
writeRasterImageToStream(stream);
return "data:" + format.mimeType() + ";base64," + DatatypeConverter.printBase64Binary(stream.toByteArray());
return "data:" + format.mimeType() + ";base64," + Base64.getEncoder().encodeToString(stream.toByteArray());
} catch (IOException e) {
throw new Error(e);
}
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/osm2world/core/target/gltf/GltfTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
import com.google.gson.GsonBuilder;
import com.google.gson.JsonIOException;

import jakarta.xml.bind.DatatypeConverter;

/**
* builds a glTF or glb (binary glTF) output file
*/
Expand Down Expand Up @@ -229,8 +227,7 @@ private int createBufferView(ByteBuffer byteBuffer, @Nullable Integer target) {
case GLTF -> {

String dataUri = "data:application/gltf-buffer;base64,"
+ DatatypeConverter.printBase64Binary(byteBuffer.array());
// TODO: replace with java.util.Base64?
+ Base64.getEncoder().encodeToString(byteBuffer.array());

GltfBuffer buffer = new GltfBuffer(byteBuffer.capacity());
buffer.uri = dataUri;
Expand Down

0 comments on commit 66946c2

Please sign in to comment.