diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 0f94a09cc..c9a2f2834 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -75,7 +75,7 @@ jobs: # minSdk and targetSdk, see ${project_root}/android_test/app/build.gradle.kts # TODO: Investigate why it is unstable on API 33. emulator: [ - { api-level: 26, target: google_apis }, + { api-level: 23, target: google_apis }, { api-level: 32, target: playstore } ] steps: @@ -91,17 +91,20 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: run tests - uses: reactivecircus/android-emulator-runner@v2 + uses: Wandalen/wretry.action@master with: - working-directory: ./android_test - api-level: ${{ matrix.emulator.api-level }} - target: ${{ matrix.emulator.target }} - script: ./gradlew connectedCheck - arch: x86_64 - profile: 'pixel_2' + attempt_limit: 3 # android test is not stable, let's retry it + action: reactivecircus/android-emulator-runner@v2 + with: | + working-directory: ./android_test + api-level: ${{ matrix.emulator.api-level }} + target: ${{ matrix.emulator.target }} + script: ./gradlew connectedCheck + arch: x86_64 + profile: 'pixel_2' deploy: - needs: [ build, javadoc ] # TODO: add android-test when it is stable. + needs: [ build, javadoc, android-test ] permissions: contents: write if: github.event_name == 'release' && github.event.action == 'created' diff --git a/CHANGELOG.md b/CHANGELOG.md index 00b3b5608..432ab47b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ As this project is pre 1.0, breaking changes may happen for minor version bumps. A breaking change will get clearly notified in this log. ## Pending +* Add `org.stellar.sdk.spi.SdkProvider`, users can implement this interface to provide their own implementation of the SDK. We provide an [Android specific implementation](https://github.com/stellar/java-stellar-sdk-android-spi), if you are integrating this SDK into an Android project, be sure to check it out. ([#543](https://github.com/stellar/java-stellar-sdk/pull/543)) * Fix issues where the validity of the encoded strkey is not verified in certain scenarios. ([#541](https://github.com/stellar/java-stellar-sdk/pull/541)) * Fix the issue of javadocJar not including documentation. ([#539](https://github.com/stellar/java-stellar-sdk/pull/539)) * Publish sourcesJar to the GitHub Release page. ([#539](https://github.com/stellar/java-stellar-sdk/pull/539)) diff --git a/Makefile b/Makefile index 82b783708..be7096a09 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ xdr/Stellar-contract.x \ xdr/Stellar-internal.x \ xdr/Stellar-contract-config-setting.x -XDRGEN_COMMIT=f0c41458ca0b66b4649b18deddc9f7a11199f1f9 +XDRGEN_COMMIT=7c9349c62844e376bc637be678695387e88d125f XDRNEXT_COMMIT=9ac02641139e6717924fdad716f6e958d0168491 .PHONY: xdr xdr-clean xdr-update diff --git a/android_test/app/build.gradle.kts b/android_test/app/build.gradle.kts index e4ef7f80a..5c57389e4 100644 --- a/android_test/app/build.gradle.kts +++ b/android_test/app/build.gradle.kts @@ -9,7 +9,7 @@ android { defaultConfig { applicationId = "org.stellar.javastellarsdkdemoapp" - minSdk = 26 + minSdk = 23 targetSdk = 33 versionCode = 1 versionName = "1.0" @@ -30,6 +30,11 @@ android { } } compileOptions { + // Flag to enable support for the new language APIs + // For AGP 4.1+ + // https://developer.android.com/studio/write/java8-support + isCoreLibraryDesugaringEnabled = true + sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } @@ -50,7 +55,9 @@ android { } dependencies { - + // For AGP 7.4+ + // https://developer.android.com/studio/write/java8-support + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3") implementation("androidx.core:core-ktx:1.9.0") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") implementation("androidx.activity:activity-compose:1.7.2") @@ -59,9 +66,9 @@ dependencies { implementation("androidx.compose.ui:ui-graphics") implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.material3:material3") - implementation(files("libs/stellar-sdk.jar")) // Since we are adding local jar(libs/stellar-sdk.jar) as dependency, // gradle cannot automatically download the required third-party dependencies. + implementation(files("libs/stellar-sdk.jar")) implementation("com.squareup.okhttp3:okhttp:4.11.0") implementation("com.squareup.okhttp3:okhttp-sse:4.11.0") implementation("com.moandjiezana.toml:toml4j:0.7.2") diff --git a/android_test/app/src/androidTest/java/org/stellar/javastellarsdkdemoapp/MainInstrumentedTest.kt b/android_test/app/src/androidTest/java/org/stellar/javastellarsdkdemoapp/MainInstrumentedTest.kt index 9c538f291..2db9e31fa 100644 --- a/android_test/app/src/androidTest/java/org/stellar/javastellarsdkdemoapp/MainInstrumentedTest.kt +++ b/android_test/app/src/androidTest/java/org/stellar/javastellarsdkdemoapp/MainInstrumentedTest.kt @@ -19,7 +19,7 @@ private const val PACKAGE = "org.stellar.javastellarsdkdemoapp" @RunWith(AndroidJUnit4::class) class MainInstrumentedTest { @Test - fun testGetNetwork() { + fun testSDK() { val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) // open app device.pressHome() @@ -41,15 +41,15 @@ class MainInstrumentedTest { ) // get text - val textNoNetworkInfo = device.wait( - Until.findObject(By.text("No network info")), + val textNoTestResult = device.wait( + Until.findObject(By.text("Not Run")), ONE_MINUTE ) - assertNotNull(textNoNetworkInfo) + assertNotNull(textNoTestResult) // get button val button = device.wait( - Until.findObject(By.text("Get Network")), + Until.findObject(By.text("Run Test")), ONE_MINUTE ) assertNotNull(button) @@ -57,6 +57,6 @@ class MainInstrumentedTest { // click button and wait text to appear button.click() - assertTrue(device.wait(Until.hasObject(By.text("public")), ONE_MINUTE * 5)) + assertTrue(device.wait(Until.hasObject(By.text("SUCCESS")), ONE_MINUTE * 5)) } } \ No newline at end of file diff --git a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/AndroidSdkProvider.kt b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/AndroidSdkProvider.kt new file mode 100644 index 000000000..5acc5c2ea --- /dev/null +++ b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/AndroidSdkProvider.kt @@ -0,0 +1,46 @@ +package org.stellar.javastellarsdkdemoapp + +import org.stellar.sdk.Base32 +import org.stellar.sdk.Base64 +import org.stellar.sdk.spi.SdkProvider + +class AndroidSdkProvider : SdkProvider { + override fun createBase64(): Base64 { + return AndroidBase64() + } + + override fun createBase32(): Base32 { + return AndroidBase32() + } + + class AndroidBase64 : Base64 { + override fun encodeToString(data: ByteArray?): String { + return android.util.Base64.encodeToString(data, android.util.Base64.NO_WRAP) + } + + override fun encode(data: ByteArray?): ByteArray { + return android.util.Base64.encode(data, android.util.Base64.NO_WRAP) + } + + override fun decode(data: String?): ByteArray { + return android.util.Base64.decode(data, android.util.Base64.NO_WRAP) + } + } + + class AndroidBase32 : Base32 { + private val base32: ApacheCodec.Base32 = ApacheCodec.Base32() + + override fun encode(data: ByteArray?): ByteArray? { + return base32.encode(data) + } + + override fun decode(data: String?): ByteArray? { + return base32.decode(data) + } + + override fun decode(data: ByteArray?): ByteArray? { + return base32.decode(data) + } + + } +} \ No newline at end of file diff --git a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/ApacheCodec.java b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/ApacheCodec.java new file mode 100644 index 000000000..e60ffe2a9 --- /dev/null +++ b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/ApacheCodec.java @@ -0,0 +1,2157 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.stellar.javastellarsdkdemoapp; + +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Objects; + +/** + * Copy from commons-codec:commons-codec:1.16.0 + * + *

This is a compromise, because the Android platform built-in with commons-codec:commons-codec: + * 1.3.0 version in API < 28, which does not include the Base32 module. See the issue + */ +class ApacheCodec { + enum CodecPolicy { + + /** The strict policy. Data that causes a codec to fail should throw an exception. */ + STRICT, + + /** The lenient policy. Data that causes a codec to fail should not throw an exception. */ + LENIENT + } + + static class Base32 extends BaseNCodec { + + /** + * BASE32 characters are 5 bits in length. They are formed by taking a block of five octets to + * form a 40-bit string, which is converted into eight BASE32 characters. + */ + private static final int BITS_PER_ENCODED_BYTE = 5; + + private static final int BYTES_PER_ENCODED_BLOCK = 8; + private static final int BYTES_PER_UNENCODED_BLOCK = 5; + + /** + * This array is a lookup table that translates Unicode characters drawn from the "Base32 + * Alphabet" (as specified in Table 3 of RFC 4648) into their 5-bit positive integer + * equivalents. Characters that are not in the Base32 alphabet but fall within the bounds of the + * array are translated to -1. + */ + private static final byte[] DECODE_TABLE = { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 00-0f + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 10-1f + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 20-2f + -1, + -1, + 26, + 27, + 28, + 29, + 30, + 31, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 30-3f 2-7 + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, // 40-4f A-O + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, // 50-5a P-Z + -1, + -1, + -1, + -1, + -1, // 5b-5f + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, // 60-6f a-o + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, // 70-7a p-z + }; + + /** + * This array is a lookup table that translates 5-bit positive integer index values into their + * "Base32 Alphabet" equivalents as specified in Table 3 of RFC 4648. + */ + private static final byte[] ENCODE_TABLE = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + '2', '3', '4', '5', '6', '7', + }; + + /** + * This array is a lookup table that translates Unicode characters drawn from the "Base32 Hex + * Alphabet" (as specified in Table 4 of RFC 4648) into their 5-bit positive integer + * equivalents. Characters that are not in the Base32 Hex alphabet but fall within the bounds of + * the array are translated to -1. + */ + private static final byte[] HEX_DECODE_TABLE = { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 00-0f + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 10-1f + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 20-2f + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + -1, + -1, + -1, + -1, + -1, + -1, // 30-3f 0-9 + -1, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, // 40-4f A-O + 25, + 26, + 27, + 28, + 29, + 30, + 31, // 50-56 P-V + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, // 57-5f + -1, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, // 60-6f a-o + 25, + 26, + 27, + 28, + 29, + 30, + 31 // 70-76 p-v + }; + + /** + * This array is a lookup table that translates 5-bit positive integer index values into their + * "Base32 Hex Alphabet" equivalents as specified in Table 4 of RFC 4648. + */ + private static final byte[] HEX_ENCODE_TABLE = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + }; + + /** Mask used to extract 5 bits, used when encoding Base32 bytes */ + private static final int MASK_5BITS = 0x1f; + + /** Mask used to extract 4 bits, used when decoding final trailing character. */ + private static final long MASK_4BITS = 0x0fL; + + /** Mask used to extract 3 bits, used when decoding final trailing character. */ + private static final long MASK_3BITS = 0x07L; + + /** Mask used to extract 2 bits, used when decoding final trailing character. */ + private static final long MASK_2BITS = 0x03L; + + /** Mask used to extract 1 bits, used when decoding final trailing character. */ + private static final long MASK_1BITS = 0x01L; + + // The static final fields above are used for the original static byte[] methods on Base32. + // The private member fields below are used with the new streaming approach, which requires + // some state be preserved between calls of encode() and decode(). + + /** + * Convenience variable to help us determine when our buffer is going to run out of room and + * needs resizing. {@code decodeSize = {@link #BYTES_PER_ENCODED_BLOCK} - 1 + + * lineSeparator.length;} + */ + private final int decodeSize; + + /** Decode table to use. */ + private final byte[] decodeTable; + + /** + * Convenience variable to help us determine when our buffer is going to run out of room and + * needs resizing. {@code encodeSize = {@link #BYTES_PER_ENCODED_BLOCK} + lineSeparator.length;} + */ + private final int encodeSize; + + /** Encode table to use. */ + private final byte[] encodeTable; + + /** Line separator for encoding. Not used when decoding. Only used if lineLength > 0. */ + private final byte[] lineSeparator; + + /** + * Creates a Base32 codec used for decoding and encoding. + * + *

When encoding the line length is 0 (no chunking). + */ + public Base32() { + this(false); + } + + /** + * Creates a Base32 codec used for decoding and encoding. + * + *

When encoding the line length is 0 (no chunking). + * + * @param useHex if {@code true} then use Base32 Hex alphabet + */ + public Base32(final boolean useHex) { + this(0, null, useHex, PAD_DEFAULT); + } + + /** + * Creates a Base32 codec used for decoding and encoding. + * + *

When encoding the line length is 0 (no chunking). + * + * @param useHex if {@code true} then use Base32 Hex alphabet + * @param padding byte used as padding byte. + */ + public Base32(final boolean useHex, final byte padding) { + this(0, null, useHex, padding); + } + + /** + * Creates a Base32 codec used for decoding and encoding. + * + *

When encoding the line length is 0 (no chunking). + * + * @param pad byte used as padding byte. + */ + public Base32(final byte pad) { + this(false, pad); + } + + /** + * Creates a Base32 codec used for decoding and encoding. + * + *

When encoding the line length is given in the constructor, the line separator is CRLF. + * + * @param lineLength Each line of encoded data will be at most of the given length (rounded down + * to the nearest multiple of 8). If lineLength <= 0, then the output will not be divided + * into lines (chunks). Ignored when decoding. + */ + public Base32(final int lineLength) { + this(lineLength, CHUNK_SEPARATOR); + } + + /** + * Creates a Base32 codec used for decoding and encoding. + * + *

When encoding the line length and line separator are given in the constructor. + * + *

Line lengths that aren't multiples of 8 will still essentially end up being multiples of 8 + * in the encoded data. + * + * @param lineLength Each line of encoded data will be at most of the given length (rounded down + * to the nearest multiple of 8). If lineLength <= 0, then the output will not be divided + * into lines (chunks). Ignored when decoding. + * @param lineSeparator Each line of encoded data will end with this sequence of bytes. + * @throws IllegalArgumentException Thrown when the {@code lineSeparator} contains Base32 + * characters. + */ + public Base32(final int lineLength, final byte[] lineSeparator) { + this(lineLength, lineSeparator, false, PAD_DEFAULT); + } + + /** + * Creates a Base32 / Base32 Hex codec used for decoding and encoding. + * + *

When encoding the line length and line separator are given in the constructor. + * + *

Line lengths that aren't multiples of 8 will still essentially end up being multiples of 8 + * in the encoded data. + * + * @param lineLength Each line of encoded data will be at most of the given length (rounded down + * to the nearest multiple of 8). If lineLength <= 0, then the output will not be divided + * into lines (chunks). Ignored when decoding. + * @param lineSeparator Each line of encoded data will end with this sequence of bytes. + * @param useHex if {@code true}, then use Base32 Hex alphabet, otherwise use Base32 alphabet + * @throws IllegalArgumentException Thrown when the {@code lineSeparator} contains Base32 + * characters. Or the lineLength > 0 and lineSeparator is null. + */ + public Base32(final int lineLength, final byte[] lineSeparator, final boolean useHex) { + this(lineLength, lineSeparator, useHex, PAD_DEFAULT); + } + + /** + * Creates a Base32 / Base32 Hex codec used for decoding and encoding. + * + *

When encoding the line length and line separator are given in the constructor. + * + *

Line lengths that aren't multiples of 8 will still essentially end up being multiples of 8 + * in the encoded data. + * + * @param lineLength Each line of encoded data will be at most of the given length (rounded down + * to the nearest multiple of 8). If lineLength <= 0, then the output will not be divided + * into lines (chunks). Ignored when decoding. + * @param lineSeparator Each line of encoded data will end with this sequence of bytes. + * @param useHex if {@code true}, then use Base32 Hex alphabet, otherwise use Base32 alphabet + * @param padding byte used as padding byte. + * @throws IllegalArgumentException Thrown when the {@code lineSeparator} contains Base32 + * characters. Or the lineLength > 0 and lineSeparator is null. + */ + public Base32( + final int lineLength, + final byte[] lineSeparator, + final boolean useHex, + final byte padding) { + this(lineLength, lineSeparator, useHex, padding, DECODING_POLICY_DEFAULT); + } + + /** + * Creates a Base32 / Base32 Hex codec used for decoding and encoding. + * + *

When encoding the line length and line separator are given in the constructor. + * + *

Line lengths that aren't multiples of 8 will still essentially end up being multiples of 8 + * in the encoded data. + * + * @param lineLength Each line of encoded data will be at most of the given length (rounded down + * to the nearest multiple of 8). If lineLength <= 0, then the output will not be divided + * into lines (chunks). Ignored when decoding. + * @param lineSeparator Each line of encoded data will end with this sequence of bytes. + * @param useHex if {@code true}, then use Base32 Hex alphabet, otherwise use Base32 alphabet + * @param padding byte used as padding byte. + * @param decodingPolicy The decoding policy. + * @throws IllegalArgumentException Thrown when the {@code lineSeparator} contains Base32 + * characters. Or the lineLength > 0 and lineSeparator is null. + * @since 1.15 + */ + public Base32( + final int lineLength, + final byte[] lineSeparator, + final boolean useHex, + final byte padding, + final CodecPolicy decodingPolicy) { + super( + BYTES_PER_UNENCODED_BLOCK, + BYTES_PER_ENCODED_BLOCK, + lineLength, + lineSeparator == null ? 0 : lineSeparator.length, + padding, + decodingPolicy); + if (useHex) { + this.encodeTable = HEX_ENCODE_TABLE; + this.decodeTable = HEX_DECODE_TABLE; + } else { + this.encodeTable = ENCODE_TABLE; + this.decodeTable = DECODE_TABLE; + } + if (lineLength > 0) { + if (lineSeparator == null) { + throw new IllegalArgumentException( + "lineLength " + lineLength + " > 0, but lineSeparator is null"); + } + // Must be done after initializing the tables + if (containsAlphabetOrPad(lineSeparator)) { + final String sep = StringUtils.newStringUtf8(lineSeparator); + throw new IllegalArgumentException( + "lineSeparator must not contain Base32 characters: [" + sep + "]"); + } + this.encodeSize = BYTES_PER_ENCODED_BLOCK + lineSeparator.length; + this.lineSeparator = lineSeparator.clone(); + } else { + this.encodeSize = BYTES_PER_ENCODED_BLOCK; + this.lineSeparator = null; + } + this.decodeSize = this.encodeSize - 1; + + if (isInAlphabet(padding) || Character.isWhitespace(padding)) { + throw new IllegalArgumentException("pad must not be in alphabet or whitespace"); + } + } + + /** + * Decodes all of the provided data, starting at inPos, for inAvail bytes. Should be called at + * least twice: once with the data to decode, and once with inAvail set to "-1" to alert decoder + * that EOF has been reached. The "-1" call is not necessary when decoding, but it doesn't hurt, + * either. + * + *

Ignores all non-Base32 characters. This is how chunked (e.g. 76 character) data is + * handled, since CR and LF are silently ignored, but has implications for other bytes, too. + * This method subscribes to the garbage-in, garbage-out philosophy: it will not check the + * provided data for validity. + * + * @param input byte[] array of ASCII data to Base32 decode. + * @param inPos Position to start reading data from. + * @param inAvail Amount of bytes available from input for decoding. + * @param context the context to be used + */ + @Override + void decode(final byte[] input, int inPos, final int inAvail, final Context context) { + // package protected for access from I/O streams + + if (context.eof) { + return; + } + if (inAvail < 0) { + context.eof = true; + } + for (int i = 0; i < inAvail; i++) { + final byte b = input[inPos++]; + if (b == pad) { + // We're done. + context.eof = true; + break; + } + final byte[] buffer = ensureBufferSize(decodeSize, context); + if (b >= 0 && b < this.decodeTable.length) { + final int result = this.decodeTable[b]; + if (result >= 0) { + context.modulus = (context.modulus + 1) % BYTES_PER_ENCODED_BLOCK; + // collect decoded bytes + context.lbitWorkArea = (context.lbitWorkArea << BITS_PER_ENCODED_BYTE) + result; + if (context.modulus == 0) { // we can output the 5 bytes + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 32) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 24) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 16) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) (context.lbitWorkArea & MASK_8BITS); + } + } + } + } + + // Two forms of EOF as far as Base32 decoder is concerned: actual + // EOF (-1) and first time '=' character is encountered in stream. + // This approach makes the '=' padding characters completely optional. + if (context.eof && context.modulus > 0) { // if modulus == 0, nothing to do + final byte[] buffer = ensureBufferSize(decodeSize, context); + + // We ignore partial bytes, i.e. only multiples of 8 count. + // Any combination not part of a valid encoding is either partially decoded + // or will raise an exception. Possible trailing characters are 2, 4, 5, 7. + // It is not possible to encode with 1, 3, 6 trailing characters. + // For backwards compatibility 3 & 6 chars are decoded anyway rather than discarded. + // See the encode(byte[]) method EOF section. + switch (context.modulus) { + // case 0 : // impossible, as excluded above + case 1: // 5 bits - either ignore entirely, or raise an exception + validateTrailingCharacters(); + case 2: // 10 bits, drop 2 and output one byte + validateCharacter(MASK_2BITS, context); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 2) & MASK_8BITS); + break; + case 3: // 15 bits, drop 7 and output 1 byte, or raise an exception + validateTrailingCharacters(); + // Not possible from a valid encoding but decode anyway + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 7) & MASK_8BITS); + break; + case 4: // 20 bits = 2*8 + 4 + validateCharacter(MASK_4BITS, context); + context.lbitWorkArea = context.lbitWorkArea >> 4; // drop 4 bits + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea) & MASK_8BITS); + break; + case 5: // 25 bits = 3*8 + 1 + validateCharacter(MASK_1BITS, context); + context.lbitWorkArea = context.lbitWorkArea >> 1; + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 16) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea) & MASK_8BITS); + break; + case 6: // 30 bits = 3*8 + 6, or raise an exception + validateTrailingCharacters(); + // Not possible from a valid encoding but decode anyway + context.lbitWorkArea = context.lbitWorkArea >> 6; + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 16) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea) & MASK_8BITS); + break; + case 7: // 35 bits = 4*8 +3 + validateCharacter(MASK_3BITS, context); + context.lbitWorkArea = context.lbitWorkArea >> 3; + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 24) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 16) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.lbitWorkArea) & MASK_8BITS); + break; + default: + // modulus can be 0-7, and we excluded 0,1 already + throw new IllegalStateException("Impossible modulus " + context.modulus); + } + } + } + + /** + * Encodes all of the provided data, starting at inPos, for inAvail bytes. Must be called at + * least twice: once with the data to encode, and once with inAvail set to "-1" to alert encoder + * that EOF has been reached, so flush last remaining bytes (if not multiple of 5). + * + * @param input byte[] array of binary data to Base32 encode. + * @param inPos Position to start reading data from. + * @param inAvail Amount of bytes available from input for encoding. + * @param context the context to be used + */ + @Override + void encode(final byte[] input, int inPos, final int inAvail, final Context context) { + // package protected for access from I/O streams + + if (context.eof) { + return; + } + // inAvail < 0 is how we're informed of EOF in the underlying data we're + // encoding. + if (inAvail < 0) { + context.eof = true; + if (0 == context.modulus && lineLength == 0) { + return; // no leftovers to process and not using chunking + } + final byte[] buffer = ensureBufferSize(encodeSize, context); + final int savedPos = context.pos; + switch (context.modulus) { // % 5 + case 0: + break; + case 1: // Only 1 octet; take top 5 bits then remainder + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 3) & MASK_5BITS]; // 8-1*5 = 3 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea << 2) & MASK_5BITS]; // 5-3=2 + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + break; + case 2: // 2 octets = 16 bits to use + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 11) & MASK_5BITS]; // 16-1*5 = 11 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 6) & MASK_5BITS]; // 16-2*5 = 6 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 1) & MASK_5BITS]; // 16-3*5 = 1 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea << 4) & MASK_5BITS]; // 5-1 = 4 + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + break; + case 3: // 3 octets = 24 bits to use + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 19) & MASK_5BITS]; // 24-1*5 = 19 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 14) & MASK_5BITS]; // 24-2*5 = 14 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 9) & MASK_5BITS]; // 24-3*5 = 9 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 4) & MASK_5BITS]; // 24-4*5 = 4 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea << 1) & MASK_5BITS]; // 5-4 = 1 + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + break; + case 4: // 4 octets = 32 bits to use + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 27) & MASK_5BITS]; // 32-1*5 = 27 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 22) & MASK_5BITS]; // 32-2*5 = 22 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 17) & MASK_5BITS]; // 32-3*5 = 17 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 12) & MASK_5BITS]; // 32-4*5 = 12 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 7) & MASK_5BITS]; // 32-5*5 = 7 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea >> 2) & MASK_5BITS]; // 32-6*5 = 2 + buffer[context.pos++] = + encodeTable[(int) (context.lbitWorkArea << 3) & MASK_5BITS]; // 5-2 = 3 + buffer[context.pos++] = pad; + break; + default: + throw new IllegalStateException("Impossible modulus " + context.modulus); + } + context.currentLinePos += context.pos - savedPos; // keep track of current line position + // if currentPos == 0 we are at the start of a line, so don't add CRLF + if (lineLength > 0 && context.currentLinePos > 0) { // add chunk separator if required + System.arraycopy(lineSeparator, 0, buffer, context.pos, lineSeparator.length); + context.pos += lineSeparator.length; + } + } else { + for (int i = 0; i < inAvail; i++) { + final byte[] buffer = ensureBufferSize(encodeSize, context); + context.modulus = (context.modulus + 1) % BYTES_PER_UNENCODED_BLOCK; + int b = input[inPos++]; + if (b < 0) { + b += 256; + } + context.lbitWorkArea = (context.lbitWorkArea << 8) + b; // BITS_PER_BYTE + if (0 == context.modulus) { // we have enough bytes to create our output + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 35) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 30) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 25) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 20) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 15) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 10) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) (context.lbitWorkArea >> 5) & MASK_5BITS]; + buffer[context.pos++] = encodeTable[(int) context.lbitWorkArea & MASK_5BITS]; + context.currentLinePos += BYTES_PER_ENCODED_BLOCK; + if (lineLength > 0 && lineLength <= context.currentLinePos) { + System.arraycopy(lineSeparator, 0, buffer, context.pos, lineSeparator.length); + context.pos += lineSeparator.length; + context.currentLinePos = 0; + } + } + } + } + } + + /** + * Returns whether or not the {@code octet} is in the Base32 alphabet. + * + * @param octet The value to test + * @return {@code true} if the value is defined in the Base32 alphabet {@code false} otherwise. + */ + @Override + public boolean isInAlphabet(final byte octet) { + return octet >= 0 && octet < decodeTable.length && decodeTable[octet] != -1; + } + + /** + * Validates whether decoding the final trailing character is possible in the context of the set + * of possible base 32 values. + * + *

The character is valid if the lower bits within the provided mask are zero. This is used + * to test the final trailing base-32 digit is zero in the bits that will be discarded. + * + * @param emptyBitsMask The mask of the lower bits that should be empty + * @param context the context to be used + * @throws IllegalArgumentException if the bits being checked contain any non-zero value + */ + private void validateCharacter(final long emptyBitsMask, final Context context) { + // Use the long bit work area + if (isStrictDecoding() && (context.lbitWorkArea & emptyBitsMask) != 0) { + throw new IllegalArgumentException( + "Strict decoding: Last encoded character (before the paddings if any) is a valid " + + "base 32 alphabet but not a possible encoding. " + + "Expected the discarded bits from the character to be zero."); + } + } + + /** + * Validates whether decoding allows final trailing characters that cannot be created during + * encoding. + * + * @throws IllegalArgumentException if strict decoding is enabled + */ + private void validateTrailingCharacters() { + if (isStrictDecoding()) { + throw new IllegalArgumentException( + "Strict decoding: Last encoded character(s) (before the paddings if any) are valid " + + "base 32 alphabet but not a possible encoding. " + + "Decoding requires either 2, 4, 5, or 7 trailing 5-bit characters to create bytes."); + } + } + } + + static class BinaryCodec { + /* + * tried to avoid using ArrayUtils to minimize dependencies while using these empty arrays - dep is just not worth + * it. + */ + /** Empty char array. */ + private static final char[] EMPTY_CHAR_ARRAY = {}; + + /** Empty byte array. */ + private static final byte[] EMPTY_BYTE_ARRAY = {}; + + /** Mask for bit 0 of a byte. */ + private static final int BIT_0 = 1; + + /** Mask for bit 1 of a byte. */ + private static final int BIT_1 = 0x02; + + /** Mask for bit 2 of a byte. */ + private static final int BIT_2 = 0x04; + + /** Mask for bit 3 of a byte. */ + private static final int BIT_3 = 0x08; + + /** Mask for bit 4 of a byte. */ + private static final int BIT_4 = 0x10; + + /** Mask for bit 5 of a byte. */ + private static final int BIT_5 = 0x20; + + /** Mask for bit 6 of a byte. */ + private static final int BIT_6 = 0x40; + + /** Mask for bit 7 of a byte. */ + private static final int BIT_7 = 0x80; + + private static final int[] BITS = {BIT_0, BIT_1, BIT_2, BIT_3, BIT_4, BIT_5, BIT_6, BIT_7}; + + /** + * Decodes a byte array where each byte represents an ASCII '0' or '1'. + * + * @param ascii each byte represents an ASCII '0' or '1' + * @return the raw encoded binary where each bit corresponds to a byte in the byte array + * argument + */ + public static byte[] fromAscii(final byte[] ascii) { + if (isEmpty(ascii)) { + return EMPTY_BYTE_ARRAY; + } + final int asciiLength = ascii.length; + // get length/8 times bytes with 3 bit shifts to the right of the length + final byte[] raw = new byte[asciiLength >> 3]; + /* + * We decr index jj by 8 as we go along to not recompute indices using multiplication every time inside the + * loop. + */ + for (int ii = 0, jj = asciiLength - 1; ii < raw.length; ii++, jj -= 8) { + for (int bits = 0; bits < BITS.length; ++bits) { + if (ascii[jj - bits] == '1') { + raw[ii] |= BITS[bits]; + } + } + } + return raw; + } + + // ------------------------------------------------------------------------ + // + // static codec operations + // + // ------------------------------------------------------------------------ + + /** + * Decodes a char array where each char represents an ASCII '0' or '1'. + * + * @param ascii each char represents an ASCII '0' or '1' + * @return the raw encoded binary where each bit corresponds to a char in the char array + * argument + */ + public static byte[] fromAscii(final char[] ascii) { + if (ascii == null || ascii.length == 0) { + return EMPTY_BYTE_ARRAY; + } + final int asciiLength = ascii.length; + // get length/8 times bytes with 3 bit shifts to the right of the length + final byte[] raw = new byte[asciiLength >> 3]; + /* + * We decr index jj by 8 as we go along to not recompute indices using multiplication every time inside the + * loop. + */ + for (int ii = 0, jj = asciiLength - 1; ii < raw.length; ii++, jj -= 8) { + for (int bits = 0; bits < BITS.length; ++bits) { + if (ascii[jj - bits] == '1') { + raw[ii] |= BITS[bits]; + } + } + } + return raw; + } + + /** + * Returns {@code true} if the given array is {@code null} or empty (size 0.) + * + * @param array the source array + * @return {@code true} if the given array is {@code null} or empty (size 0.) + */ + static boolean isEmpty(final byte[] array) { + return array == null || array.length == 0; + } + + /** + * Converts an array of raw binary data into an array of ASCII 0 and 1 character bytes - each + * byte is a truncated char. + * + * @param raw the raw binary data to convert + * @return an array of 0 and 1 character bytes for each bit of the argument + */ + public static byte[] toAsciiBytes(final byte[] raw) { + if (isEmpty(raw)) { + return EMPTY_BYTE_ARRAY; + } + final int rawLength = raw.length; + // get 8 times the bytes with 3 bit shifts to the left of the length + final byte[] l_ascii = new byte[rawLength << 3]; + /* + * We decr index jj by 8 as we go along to not recompute indices using multiplication every time inside the + * loop. + */ + for (int ii = 0, jj = l_ascii.length - 1; ii < rawLength; ii++, jj -= 8) { + for (int bits = 0; bits < BITS.length; ++bits) { + if ((raw[ii] & BITS[bits]) == 0) { + l_ascii[jj - bits] = '0'; + } else { + l_ascii[jj - bits] = '1'; + } + } + } + return l_ascii; + } + + /** + * Converts an array of raw binary data into an array of ASCII 0 and 1 characters. + * + * @param raw the raw binary data to convert + * @return an array of 0 and 1 characters for each bit of the argument + */ + public static char[] toAsciiChars(final byte[] raw) { + if (isEmpty(raw)) { + return EMPTY_CHAR_ARRAY; + } + final int rawLength = raw.length; + // get 8 times the bytes with 3 bit shifts to the left of the length + final char[] l_ascii = new char[rawLength << 3]; + /* + * We decr index jj by 8 as we go along to not recompute indices using multiplication every time inside the + * loop. + */ + for (int ii = 0, jj = l_ascii.length - 1; ii < rawLength; ii++, jj -= 8) { + for (int bits = 0; bits < BITS.length; ++bits) { + if ((raw[ii] & BITS[bits]) == 0) { + l_ascii[jj - bits] = '0'; + } else { + l_ascii[jj - bits] = '1'; + } + } + } + return l_ascii; + } + + /** + * Converts an array of raw binary data into a String of ASCII 0 and 1 characters. + * + * @param raw the raw binary data to convert + * @return a String of 0 and 1 characters representing the binary data + */ + public static String toAsciiString(final byte[] raw) { + return new String(toAsciiChars(raw)); + } + + /** + * Decodes a byte array where each byte represents an ASCII '0' or '1'. + * + * @param ascii each byte represents an ASCII '0' or '1' + * @return the raw encoded binary where each bit corresponds to a byte in the byte array + * argument + */ + public byte[] decode(final byte[] ascii) { + return fromAscii(ascii); + } + + /** + * Decodes a byte array where each byte represents an ASCII '0' or '1'. + * + * @param ascii each byte represents an ASCII '0' or '1' + * @return the raw encoded binary where each bit corresponds to a byte in the byte array + * argument + * @throws DecoderException if argument is not a byte[], char[] or String + */ + public Object decode(final Object ascii) throws DecoderException { + if (ascii == null) { + return EMPTY_BYTE_ARRAY; + } + if (ascii instanceof byte[]) { + return fromAscii((byte[]) ascii); + } + if (ascii instanceof char[]) { + return fromAscii((char[]) ascii); + } + if (ascii instanceof String) { + return fromAscii(((String) ascii).toCharArray()); + } + throw new DecoderException("argument not a byte array"); + } + + /** + * Converts an array of raw binary data into an array of ASCII 0 and 1 characters. + * + * @param raw the raw binary data to convert + * @return 0 and 1 ASCII character bytes one for each bit of the argument + */ + public byte[] encode(final byte[] raw) { + return toAsciiBytes(raw); + } + + /** + * Converts an array of raw binary data into an array of ASCII 0 and 1 chars. + * + * @param raw the raw binary data to convert + * @return 0 and 1 ASCII character chars one for each bit of the argument + * @throws EncoderException if the argument is not a byte[] + */ + public Object encode(final Object raw) throws EncoderException { + if (!(raw instanceof byte[])) { + throw new EncoderException("argument not a byte array"); + } + return toAsciiChars((byte[]) raw); + } + + /** + * Decodes a String where each char of the String represents an ASCII '0' or '1'. + * + * @param ascii String of '0' and '1' characters + * @return the raw encoded binary where each bit corresponds to a byte in the byte array + * argument + */ + public byte[] toByteArray(final String ascii) { + if (ascii == null) { + return EMPTY_BYTE_ARRAY; + } + return fromAscii(ascii.toCharArray()); + } + } + + abstract static class BaseNCodec { + + /** + * MIME chunk size per RFC 2045 section 6.8. + * + *

The {@value} character limit does not count the trailing CRLF, but counts all other + * characters, including any equal signs. + * + * @see RFC 2045 section 6.8 + */ + public static final int MIME_CHUNK_SIZE = 76; + + /** + * PEM chunk size per RFC 1421 section 4.3.2.4. + * + *

The {@value} character limit does not count the trailing CRLF, but counts all other + * characters, including any equal signs. + * + * @see RFC 1421 section 4.3.2.4 + */ + public static final int PEM_CHUNK_SIZE = 64; + + /** Mask used to extract 8 bits, used in decoding bytes */ + protected static final int MASK_8BITS = 0xff; + + /** Byte used to pad output. */ + protected static final byte PAD_DEFAULT = '='; // Allow static access to default + + /** + * The default decoding policy. + * + * @since 1.15 + */ + protected static final CodecPolicy DECODING_POLICY_DEFAULT = CodecPolicy.LENIENT; + + /** + * EOF + * + * @since 1.7 + */ + static final int EOF = -1; + + /** + * Chunk separator per RFC 2045 section 2.1. + * + * @see RFC 2045 section 2.1 + */ + static final byte[] CHUNK_SEPARATOR = {'\r', '\n'}; + + private static final int DEFAULT_BUFFER_RESIZE_FACTOR = 2; + + /** + * Defines the default buffer size - currently {@value} - must be large enough for at least one + * encoded block+separator + */ + private static final int DEFAULT_BUFFER_SIZE = 8192; + + /** + * The maximum size buffer to allocate. + * + *

This is set to the same size used in the JDK {@code java.util.ArrayList}: + * + *

+ * + *

Some VMs reserve some header words in an array. Attempts to allocate larger arrays may + * result in OutOfMemoryError: Requested array size exceeds VM limit. + * + *

+ */ + private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8; + + /** + * @deprecated Use {@link #pad}. Will be removed in 2.0. + */ + @Deprecated + protected final byte PAD = PAD_DEFAULT; // instance variable just in case it needs to vary later + + /** Pad byte. Instance variable just in case it needs to vary later. */ + protected final byte pad; + + /** + * Chunksize for encoding. Not used when decoding. A value of zero or less implies no chunking + * of the encoded data. Rounded down to the nearest multiple of encodedBlockSize. + */ + protected final int lineLength; + + /** Number of bytes in each full block of unencoded data, e.g. 4 for Base64 and 5 for Base32 */ + private final int unencodedBlockSize; + + /** Number of bytes in each full block of encoded data, e.g. 3 for Base64 and 8 for Base32 */ + private final int encodedBlockSize; + + /** Size of chunk separator. Not used unless {@link #lineLength} > 0. */ + private final int chunkSeparatorLength; + + /** + * Defines the decoding behavior when the input bytes contain leftover trailing bits that cannot + * be created by a valid encoding. These can be bits that are unused from the final character or + * entire characters. The default mode is lenient decoding. Set this to {@code true} to enable + * strict decoding. + * + * + * + *

When strict decoding is enabled it is expected that the decoded bytes will be re-encoded + * to a byte array that matches the original, i.e. no changes occur on the final character. This + * requires that the input bytes use the same padding and alphabet as the encoder. + */ + private final CodecPolicy decodingPolicy; + + /** + * Note {@code lineLength} is rounded down to the nearest multiple of the encoded block size. If + * {@code chunkSeparatorLength} is zero, then chunking is disabled. + * + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length {@code lineLength} + * @param chunkSeparatorLength the chunk separator length, if relevant + */ + protected BaseNCodec( + final int unencodedBlockSize, + final int encodedBlockSize, + final int lineLength, + final int chunkSeparatorLength) { + this(unencodedBlockSize, encodedBlockSize, lineLength, chunkSeparatorLength, PAD_DEFAULT); + } + + /** + * Note {@code lineLength} is rounded down to the nearest multiple of the encoded block size. If + * {@code chunkSeparatorLength} is zero, then chunking is disabled. + * + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length {@code lineLength} + * @param chunkSeparatorLength the chunk separator length, if relevant + * @param pad byte used as padding byte. + */ + protected BaseNCodec( + final int unencodedBlockSize, + final int encodedBlockSize, + final int lineLength, + final int chunkSeparatorLength, + final byte pad) { + this( + unencodedBlockSize, + encodedBlockSize, + lineLength, + chunkSeparatorLength, + pad, + DECODING_POLICY_DEFAULT); + } + + /** + * Note {@code lineLength} is rounded down to the nearest multiple of the encoded block size. If + * {@code chunkSeparatorLength} is zero, then chunking is disabled. + * + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length {@code lineLength} + * @param chunkSeparatorLength the chunk separator length, if relevant + * @param pad byte used as padding byte. + * @param decodingPolicy Decoding policy. + * @since 1.15 + */ + protected BaseNCodec( + final int unencodedBlockSize, + final int encodedBlockSize, + final int lineLength, + final int chunkSeparatorLength, + final byte pad, + final CodecPolicy decodingPolicy) { + this.unencodedBlockSize = unencodedBlockSize; + this.encodedBlockSize = encodedBlockSize; + final boolean useChunking = lineLength > 0 && chunkSeparatorLength > 0; + this.lineLength = useChunking ? (lineLength / encodedBlockSize) * encodedBlockSize : 0; + this.chunkSeparatorLength = chunkSeparatorLength; + this.pad = pad; + this.decodingPolicy = Objects.requireNonNull(decodingPolicy, "codecPolicy"); + } + + /** + * Create a positive capacity at least as large the minimum required capacity. If the minimum + * capacity is negative then this throws an OutOfMemoryError as no array can be allocated. + * + * @param minCapacity the minimum capacity + * @return the capacity + * @throws OutOfMemoryError if the {@code minCapacity} is negative + */ + private static int createPositiveCapacity(final int minCapacity) { + if (minCapacity < 0) { + // overflow + throw new OutOfMemoryError("Unable to allocate array size: " + (minCapacity & 0xffffffffL)); + } + // This is called when we require buffer expansion to a very big array. + // Use the conservative maximum buffer size if possible, otherwise the biggest required. + // + // Note: In this situation JDK 1.8 java.util.ArrayList returns Integer.MAX_VALUE. + // This excludes some VMs that can exceed MAX_BUFFER_SIZE but not allocate a full + // Integer.MAX_VALUE length array. + // The result is that we may have to allocate an array of this size more than once if + // the capacity must be expanded again. + return Math.max(minCapacity, MAX_BUFFER_SIZE); + } + + /** + * Gets a copy of the chunk separator per RFC 2045 section 2.1. + * + * @return the chunk separator + * @see RFC 2045 section 2.1 + * @since 1.15 + */ + public static byte[] getChunkSeparator() { + return CHUNK_SEPARATOR.clone(); + } + + /** + * Checks if a byte value is whitespace or not. + * + * @param byteToCheck the byte to check + * @return true if byte is whitespace, false otherwise + * @see Character#isWhitespace(int) + * @deprecated Use {@link Character#isWhitespace(int)}. + */ + @Deprecated + protected static boolean isWhiteSpace(final byte byteToCheck) { + return Character.isWhitespace(byteToCheck); + } + + /** + * Increases our buffer by the {@link #DEFAULT_BUFFER_RESIZE_FACTOR}. + * + * @param context the context to be used + * @param minCapacity the minimum required capacity + * @return the resized byte[] buffer + * @throws OutOfMemoryError if the {@code minCapacity} is negative + */ + private static byte[] resizeBuffer(final Context context, final int minCapacity) { + // Overflow-conscious code treats the min and new capacity as unsigned. + final int oldCapacity = context.buffer.length; + int newCapacity = oldCapacity * DEFAULT_BUFFER_RESIZE_FACTOR; + if (Integer.compareUnsigned(newCapacity, minCapacity) < 0) { + newCapacity = minCapacity; + } + if (Integer.compareUnsigned(newCapacity, MAX_BUFFER_SIZE) > 0) { + newCapacity = createPositiveCapacity(minCapacity); + } + + final byte[] b = Arrays.copyOf(context.buffer, newCapacity); + context.buffer = b; + return b; + } + + /** + * Returns the amount of buffered data available for reading. + * + * @param context the context to be used + * @return The amount of buffered data available for reading. + */ + int available(final Context context) { // package protected for access from I/O streams + return hasData(context) ? context.pos - context.readPos : 0; + } + + /** + * Tests a given byte array to see if it contains any characters within the alphabet or PAD. + * + *

Intended for use in checking line-ending arrays + * + * @param arrayOctet byte array to test + * @return {@code true} if any byte is a valid character in the alphabet or PAD; {@code false} + * otherwise + */ + protected boolean containsAlphabetOrPad(final byte[] arrayOctet) { + if (arrayOctet == null) { + return false; + } + for (final byte element : arrayOctet) { + if (pad == element || isInAlphabet(element)) { + return true; + } + } + return false; + } + + /** + * Decodes a byte[] containing characters in the Base-N alphabet. + * + * @param pArray A byte array containing Base-N character data + * @return a byte array containing binary data + */ + public byte[] decode(final byte[] pArray) { + if (BinaryCodec.isEmpty(pArray)) { + return pArray; + } + final Context context = new Context(); + decode(pArray, 0, pArray.length, context); + decode(pArray, 0, EOF, context); // Notify decoder of EOF. + final byte[] result = new byte[context.pos]; + readResults(result, 0, result.length, context); + return result; + } + + // package protected for access from I/O streams + abstract void decode(byte[] pArray, int i, int length, Context context); + + /** + * Decodes an Object using the Base-N algorithm. This method is provided in order to satisfy the + * requirements of the Decoder interface, and will throw a DecoderException if the supplied + * object is not of type byte[] or String. + * + * @param obj Object to decode + * @return An object (of type byte[]) containing the binary data which corresponds to the byte[] + * or String supplied. + * @throws DecoderException if the parameter supplied is not of type byte[] + */ + public Object decode(final Object obj) throws DecoderException { + if (obj instanceof byte[]) { + return decode((byte[]) obj); + } + if (obj instanceof String) { + return decode((String) obj); + } + throw new DecoderException("Parameter supplied to Base-N decode is not a byte[] or a String"); + } + + /** + * Decodes a String containing characters in the Base-N alphabet. + * + * @param pArray A String containing Base-N character data + * @return a byte array containing binary data + */ + public byte[] decode(final String pArray) { + return decode(StringUtils.getBytesUtf8(pArray)); + } + + /** + * Encodes a byte[] containing binary data, into a byte[] containing characters in the alphabet. + * + * @param pArray a byte array containing binary data + * @return A byte array containing only the base N alphabetic character data + */ + public byte[] encode(final byte[] pArray) { + if (BinaryCodec.isEmpty(pArray)) { + return pArray; + } + return encode(pArray, 0, pArray.length); + } + + /** + * Encodes a byte[] containing binary data, into a byte[] containing characters in the alphabet. + * + * @param pArray a byte array containing binary data + * @param offset initial offset of the subarray. + * @param length length of the subarray. + * @return A byte array containing only the base N alphabetic character data + * @since 1.11 + */ + public byte[] encode(final byte[] pArray, final int offset, final int length) { + if (BinaryCodec.isEmpty(pArray)) { + return pArray; + } + final Context context = new Context(); + encode(pArray, offset, length, context); + encode(pArray, offset, EOF, context); // Notify encoder of EOF. + final byte[] buf = new byte[context.pos - context.readPos]; + readResults(buf, 0, buf.length, context); + return buf; + } + + // package protected for access from I/O streams + abstract void encode(byte[] pArray, int i, int length, Context context); + + /** + * Encodes an Object using the Base-N algorithm. This method is provided in order to satisfy the + * requirements of the Encoder interface, and will throw an EncoderException if the supplied + * object is not of type byte[]. + * + * @param obj Object to encode + * @return An object (of type byte[]) containing the Base-N encoded data which corresponds to + * the byte[] supplied. + * @throws EncoderException if the parameter supplied is not of type byte[] + */ + public Object encode(final Object obj) throws EncoderException { + if (!(obj instanceof byte[])) { + throw new EncoderException("Parameter supplied to Base-N encode is not a byte[]"); + } + return encode((byte[]) obj); + } + + /** + * Encodes a byte[] containing binary data, into a String containing characters in the + * appropriate alphabet. Uses UTF8 encoding. + * + * @param pArray a byte array containing binary data + * @return String containing only character data in the appropriate alphabet. + * @since 1.5 This is a duplicate of {@link #encodeToString(byte[])}; it was merged during + * refactoring. + */ + public String encodeAsString(final byte[] pArray) { + return StringUtils.newStringUtf8(encode(pArray)); + } + + /** + * Encodes a byte[] containing binary data, into a String containing characters in the Base-N + * alphabet. Uses UTF8 encoding. + * + * @param pArray a byte array containing binary data + * @return A String containing only Base-N character data + */ + public String encodeToString(final byte[] pArray) { + return StringUtils.newStringUtf8(encode(pArray)); + } + + /** + * Ensure that the buffer has room for {@code size} bytes + * + * @param size minimum spare space required + * @param context the context to be used + * @return the buffer + */ + protected byte[] ensureBufferSize(final int size, final Context context) { + if (context.buffer == null) { + context.buffer = new byte[Math.max(size, getDefaultBufferSize())]; + context.pos = 0; + context.readPos = 0; + + // Overflow-conscious: + // x + y > z == x + y - z > 0 + } else if (context.pos + size - context.buffer.length > 0) { + return resizeBuffer(context, context.pos + size); + } + return context.buffer; + } + + /** + * Returns the decoding behavior policy. + * + *

The default is lenient. If the decoding policy is strict, then decoding will raise an + * {@link IllegalArgumentException} if trailing bits are not part of a valid encoding. Decoding + * will compose trailing bits into 8-bit bytes and discard the remainder. + * + * @return true if using strict decoding + * @since 1.15 + */ + public CodecPolicy getCodecPolicy() { + return decodingPolicy; + } + + /** + * Get the default buffer size. Can be overridden. + * + * @return the default buffer size. + */ + protected int getDefaultBufferSize() { + return DEFAULT_BUFFER_SIZE; + } + + /** + * Calculates the amount of space needed to encode the supplied array. + * + * @param pArray byte[] array which will later be encoded + * @return amount of space needed to encode the supplied array. Returns a long since a max-len + * array will require > Integer.MAX_VALUE + */ + public long getEncodedLength(final byte[] pArray) { + // Calculate non-chunked size - rounded up to allow for padding + // cast to long is needed to avoid possibility of overflow + long len = + ((pArray.length + unencodedBlockSize - 1) / unencodedBlockSize) * (long) encodedBlockSize; + if (lineLength > 0) { // We're using chunking + // Round up to nearest multiple + len += ((len + lineLength - 1) / lineLength) * chunkSeparatorLength; + } + return len; + } + + /** + * Returns true if this object has buffered data for reading. + * + * @param context the context to be used + * @return true if there is data still available for reading. + */ + boolean hasData(final Context context) { // package protected for access from I/O streams + return context.pos > context.readPos; + } + + /** + * Returns whether or not the {@code octet} is in the current alphabet. Does not allow + * whitespace or pad. + * + * @param value The value to test + * @return {@code true} if the value is defined in the current alphabet, {@code false} + * otherwise. + */ + protected abstract boolean isInAlphabet(byte value); + + /** + * Tests a given byte array to see if it contains only valid characters within the alphabet. The + * method optionally treats whitespace and pad as valid. + * + * @param arrayOctet byte array to test + * @param allowWSPad if {@code true}, then whitespace and PAD are also allowed + * @return {@code true} if all bytes are valid characters in the alphabet or if the byte array + * is empty; {@code false}, otherwise + */ + public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) { + for (final byte octet : arrayOctet) { + if (!isInAlphabet(octet) + && (!allowWSPad || (octet != pad) && !Character.isWhitespace(octet))) { + return false; + } + } + return true; + } + + /** + * Tests a given String to see if it contains only valid characters within the alphabet. The + * method treats whitespace and PAD as valid. + * + * @param basen String to test + * @return {@code true} if all characters in the String are valid characters in the alphabet or + * if the String is empty; {@code false}, otherwise + * @see #isInAlphabet(byte[], boolean) + */ + public boolean isInAlphabet(final String basen) { + return isInAlphabet(StringUtils.getBytesUtf8(basen), true); + } + + /** + * Returns true if decoding behavior is strict. Decoding will raise an {@link + * IllegalArgumentException} if trailing bits are not part of a valid encoding. + * + *

The default is false for lenient decoding. Decoding will compose trailing bits into 8-bit + * bytes and discard the remainder. + * + * @return true if using strict decoding + * @since 1.15 + */ + public boolean isStrictDecoding() { + return decodingPolicy == CodecPolicy.STRICT; + } + + /** + * Extracts buffered data into the provided byte[] array, starting at position bPos, up to a + * maximum of bAvail bytes. Returns how many bytes were actually extracted. + * + *

Package private for access from I/O streams. + * + * @param b byte[] array to extract the buffered data into. + * @param bPos position in byte[] array to start extraction at. + * @param bAvail amount of bytes we're allowed to extract. We may extract fewer (if fewer are + * available). + * @param context the context to be used + * @return The number of bytes successfully extracted into the provided byte[] array. + */ + int readResults(final byte[] b, final int bPos, final int bAvail, final Context context) { + if (hasData(context)) { + final int len = Math.min(available(context), bAvail); + System.arraycopy(context.buffer, context.readPos, b, bPos, len); + context.readPos += len; + if (!hasData(context)) { + // All data read. + // Reset position markers but do not set buffer to null to allow its reuse. + // hasData(context) will still return false, and this method will return 0 until + // more data is available, or -1 if EOF. + context.pos = context.readPos = 0; + } + return len; + } + return context.eof ? EOF : 0; + } + + /** + * Holds thread context so classes can be thread-safe. + * + *

This class is not itself thread-safe; each thread must allocate its own copy. + * + * @since 1.7 + */ + static class Context { + + /** + * Placeholder for the bytes we're dealing with for our based logic. Bitwise operations store + * and extract the encoding or decoding from this variable. + */ + int ibitWorkArea; + + /** + * Placeholder for the bytes we're dealing with for our based logic. Bitwise operations store + * and extract the encoding or decoding from this variable. + */ + long lbitWorkArea; + + /** Buffer for streaming. */ + byte[] buffer; + + /** Position where next character should be written in the buffer. */ + int pos; + + /** Position where next character should be read from the buffer. */ + int readPos; + + /** + * Boolean flag to indicate the EOF has been reached. Once EOF has been reached, this object + * becomes useless, and must be thrown away. + */ + boolean eof; + + /** + * Variable tracks how many characters have been written to the current line. Only used when + * encoding. We use it to make sure each encoded line never goes beyond lineLength (if + * lineLength > 0). + */ + int currentLinePos; + + /** + * Writes to the buffer only occur after every 3/5 reads when encoding, and every 4/8 reads + * when decoding. This variable helps track that. + */ + int modulus; + + /** + * Returns a String useful for debugging (especially within a debugger.) + * + * @return a String useful for debugging. + */ + @SuppressWarnings("boxing") // OK to ignore boxing here + @Override + public String toString() { + return String.format( + "%s[buffer=%s, currentLinePos=%s, eof=%s, ibitWorkArea=%s, lbitWorkArea=%s, " + + "modulus=%s, pos=%s, readPos=%s]", + this.getClass().getSimpleName(), + Arrays.toString(buffer), + currentLinePos, + eof, + ibitWorkArea, + lbitWorkArea, + modulus, + pos, + readPos); + } + } + } + + static class BaseNCodecOutputStream extends FilterOutputStream { + + private final boolean doEncode; + + private final BaseNCodec baseNCodec; + + private final byte[] singleByte = new byte[1]; + + private final BaseNCodec.Context context = new BaseNCodec.Context(); + + /** + * @param outputStream the underlying output or null. + * @param basedCodec a BaseNCodec. + * @param doEncode true to encode, false to decode + */ + public BaseNCodecOutputStream( + final OutputStream outputStream, final BaseNCodec basedCodec, final boolean doEncode) { + super(outputStream); + this.baseNCodec = basedCodec; + this.doEncode = doEncode; + } + + /** + * Closes this output stream and releases any system resources associated with the stream. + * + *

To write the EOF marker without closing the stream, call {@link #eof()} or use an Apache Commons IO CloseShieldOutputStream. + * + * @throws IOException if an I/O error occurs. + */ + @Override + public void close() throws IOException { + eof(); + flush(); + out.close(); + } + + /** + * Writes EOF. + * + * @since 1.11 + */ + public void eof() { + // Notify encoder of EOF (-1). + if (doEncode) { + baseNCodec.encode(singleByte, 0, BaseNCodec.EOF, context); + } else { + baseNCodec.decode(singleByte, 0, BaseNCodec.EOF, context); + } + } + + /** + * Flushes this output stream and forces any buffered output bytes to be written out to the + * stream. + * + * @throws IOException if an I/O error occurs. + */ + @Override + public void flush() throws IOException { + flush(true); + } + + /** + * Flushes this output stream and forces any buffered output bytes to be written out to the + * stream. If propagate is true, the wrapped stream will also be flushed. + * + * @param propagate boolean flag to indicate whether the wrapped OutputStream should also be + * flushed. + * @throws IOException if an I/O error occurs. + */ + private void flush(final boolean propagate) throws IOException { + final int avail = baseNCodec.available(context); + if (avail > 0) { + final byte[] buf = new byte[avail]; + final int c = baseNCodec.readResults(buf, 0, avail, context); + if (c > 0) { + out.write(buf, 0, c); + } + } + if (propagate) { + out.flush(); + } + } + + /** + * Returns true if decoding behavior is strict. Decoding will raise an {@link + * IllegalArgumentException} if trailing bits are not part of a valid encoding. + * + *

The default is false for lenient encoding. Decoding will compose trailing bits into 8-bit + * bytes and discard the remainder. + * + * @return true if using strict decoding + * @since 1.15 + */ + public boolean isStrictDecoding() { + return baseNCodec.isStrictDecoding(); + } + + /** + * Writes {@code len} bytes from the specified {@code b} array starting at {@code offset} to + * this output stream. + * + * @param array source byte array + * @param offset where to start reading the bytes + * @param len maximum number of bytes to write + * @throws IOException if an I/O error occurs. + * @throws NullPointerException if the byte array parameter is null + * @throws IndexOutOfBoundsException if offset, len or buffer size are invalid + */ + @Override + public void write(final byte[] array, final int offset, final int len) throws IOException { + Objects.requireNonNull(array, "array"); + if (offset < 0 || len < 0) { + throw new IndexOutOfBoundsException(); + } + if (offset > array.length || offset + len > array.length) { + throw new IndexOutOfBoundsException(); + } + if (len > 0) { + if (doEncode) { + baseNCodec.encode(array, offset, len, context); + } else { + baseNCodec.decode(array, offset, len, context); + } + flush(false); + } + } + + /** + * Writes the specified {@code byte} to this output stream. + * + * @param i source byte + * @throws IOException if an I/O error occurs. + */ + @Override + public void write(final int i) throws IOException { + singleByte[0] = (byte) i; + write(singleByte, 0, 1); + } + } + + static class Base32OutputStream extends BaseNCodecOutputStream { + + /** + * Creates a Base32OutputStream such that all data written is Base32-encoded to the original + * provided OutputStream. + * + * @param outputStream OutputStream to wrap. + */ + public Base32OutputStream(final OutputStream outputStream) { + this(outputStream, true); + } + + /** + * Creates a Base32OutputStream such that all data written is either Base32-encoded or + * Base32-decoded to the original provided OutputStream. + * + * @param outputStream OutputStream to wrap. + * @param doEncode true if we should encode all data written to us, false if we should decode. + */ + public Base32OutputStream(final OutputStream outputStream, final boolean doEncode) { + super(outputStream, new Base32(false), doEncode); + } + + /** + * Creates a Base32OutputStream such that all data written is either Base32-encoded or + * Base32-decoded to the original provided OutputStream. + * + * @param outputStream OutputStream to wrap. + * @param doEncode true if we should encode all data written to us, false if we should decode. + * @param lineLength If doEncode is true, each line of encoded data will contain lineLength + * characters (rounded down to the nearest multiple of 4). If lineLength <= 0, the + * encoded data is not divided into lines. If doEncode is false, lineLength is ignored. + * @param lineSeparator If doEncode is true, each line of encoded data will be terminated with + * this byte sequence (e.g. \r\n). If lineLength <= 0, the lineSeparator is not used. If + * doEncode is false lineSeparator is ignored. + */ + public Base32OutputStream( + final OutputStream outputStream, + final boolean doEncode, + final int lineLength, + final byte[] lineSeparator) { + super(outputStream, new Base32(lineLength, lineSeparator), doEncode); + } + + /** + * Creates a Base32OutputStream such that all data written is either Base32-encoded or + * Base32-decoded to the original provided OutputStream. + * + * @param outputStream OutputStream to wrap. + * @param doEncode true if we should encode all data written to us, false if we should decode. + * @param lineLength If doEncode is true, each line of encoded data will contain lineLength + * characters (rounded down to the nearest multiple of 4). If lineLength <= 0, the + * encoded data is not divided into lines. If doEncode is false, lineLength is ignored. + * @param lineSeparator If doEncode is true, each line of encoded data will be terminated with + * this byte sequence (e.g. \r\n). If lineLength <= 0, the lineSeparator is not used. If + * doEncode is false lineSeparator is ignored. + * @param decodingPolicy The decoding policy. + * @since 1.15 + */ + public Base32OutputStream( + final OutputStream outputStream, + final boolean doEncode, + final int lineLength, + final byte[] lineSeparator, + final CodecPolicy decodingPolicy) { + super( + outputStream, + new Base32(lineLength, lineSeparator, false, BaseNCodec.PAD_DEFAULT, decodingPolicy), + doEncode); + } + } + + static class DecoderException extends Exception { + + /** + * Declares the Serial Version Uid. + * + * @see Always Declare Serial + * Version Uid + */ + private static final long serialVersionUID = 1L; + + /** + * Constructs a new exception with {@code null} as its detail message. The cause is not + * initialized, and may subsequently be initialized by a call to {@link #initCause}. + * + * @since 1.4 + */ + public DecoderException() {} + + /** + * Constructs a new exception with the specified detail message. The cause is not initialized, + * and may subsequently be initialized by a call to {@link #initCause}. + * + * @param message The detail message which is saved for later retrieval by the {@link + * #getMessage()} method. + */ + public DecoderException(final String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + * + *

Note that the detail message associated with {@code cause} is not automatically + * incorporated into this exception's detail message. + * + * @param message The detail message which is saved for later retrieval by the {@link + * #getMessage()} method. + * @param cause The cause which is saved for later retrieval by the {@link #getCause()} method. + * A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown. + * @since 1.4 + */ + public DecoderException(final String message, final Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified cause and a detail message of + * (cause==null ? + * null : cause.toString()) (which typically contains the class and detail message of + * {@code cause}). This constructor is useful for exceptions that are little more than wrappers + * for other throwables. + * + * @param cause The cause which is saved for later retrieval by the {@link #getCause()} method. + * A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown. + * @since 1.4 + */ + public DecoderException(final Throwable cause) { + super(cause); + } + } + + static class EncoderException extends Exception { + + /** + * Declares the Serial Version Uid. + * + * @see Always Declare Serial + * Version Uid + */ + private static final long serialVersionUID = 1L; + + /** + * Constructs a new exception with {@code null} as its detail message. The cause is not + * initialized, and may subsequently be initialized by a call to {@link #initCause}. + * + * @since 1.4 + */ + public EncoderException() {} + + /** + * Constructs a new exception with the specified detail message. The cause is not initialized, + * and may subsequently be initialized by a call to {@link #initCause}. + * + * @param message a useful message relating to the encoder specific error. + */ + public EncoderException(final String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + * + *

Note that the detail message associated with {@code cause} is not automatically + * incorporated into this exception's detail message. + * + * @param message The detail message which is saved for later retrieval by the {@link + * #getMessage()} method. + * @param cause The cause which is saved for later retrieval by the {@link #getCause()} method. + * A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown. + * @since 1.4 + */ + public EncoderException(final String message, final Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified cause and a detail message of + * (cause==null ? + * null : cause.toString()) (which typically contains the class and detail message of + * {@code cause}). This constructor is useful for exceptions that are little more than wrappers + * for other throwables. + * + * @param cause The cause which is saved for later retrieval by the {@link #getCause()} method. + * A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown. + * @since 1.4 + */ + public EncoderException(final Throwable cause) { + super(cause); + } + } + + static class StringUtils { + /** + * Calls {@link String#getBytes(Charset)} + * + * @param string The string to encode (if null, return null). + * @param charset The {@link Charset} to encode the {@code String} + * @return the encoded bytes + */ + private static byte[] getBytes(final String string, final Charset charset) { + return string == null ? null : string.getBytes(charset); + } + + /** + * Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result + * into a new byte array. + * + * @param string the String to encode, may be {@code null} + * @return encoded bytes, or {@code null} if the input string was {@code null} + * @throws NullPointerException Thrown if {@link StandardCharsets#UTF_8} is not initialized, + * which should never happen since it is required by the Java platform specification. + * @see Charset + * @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException + */ + public static byte[] getBytesUtf8(final String string) { + return getBytes(string, StandardCharsets.UTF_8); + } + + /** + * Constructs a new {@code String} by decoding the specified array of bytes using the given + * charset. + * + * @param bytes The bytes to be decoded into characters + * @param charset The {@link Charset} to encode the {@code String}; not {@code null} + * @return A new {@code String} decoded from the specified array of bytes using the given + * charset, or {@code null} if the input byte array was {@code null}. + * @throws NullPointerException Thrown if charset is {@code null} + */ + private static String newString(final byte[] bytes, final Charset charset) { + return bytes == null ? null : new String(bytes, charset); + } + + /** + * Constructs a new {@code String} by decoding the specified array of bytes using the US-ASCII + * charset. + * + * @param bytes The bytes to be decoded into characters + * @return A new {@code String} decoded from the specified array of bytes using the US-ASCII + * charset, or {@code null} if the input byte array was {@code null}. + * @throws NullPointerException Thrown if {@link StandardCharsets#US_ASCII} is not initialized, + * which should never happen since it is required by the Java platform specification. + * @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException + */ + public static String newStringUsAscii(final byte[] bytes) { + return newString(bytes, StandardCharsets.US_ASCII); + } + + /** + * Constructs a new {@code String} by decoding the specified array of bytes using the UTF-8 + * charset. + * + * @param bytes The bytes to be decoded into characters + * @return A new {@code String} decoded from the specified array of bytes using the UTF-8 + * charset, or {@code null} if the input byte array was {@code null}. + * @throws NullPointerException Thrown if {@link StandardCharsets#UTF_8} is not initialized, + * which should never happen since it is required by the Java platform specification. + * @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException + */ + public static String newStringUtf8(final byte[] bytes) { + return newString(bytes, StandardCharsets.UTF_8); + } + } +} diff --git a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt index a7b0f7fab..c5bf30bc5 100644 --- a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt +++ b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt @@ -1,6 +1,7 @@ package org.stellar.javastellarsdkdemoapp import android.os.Bundle +import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.Arrangement @@ -26,19 +27,57 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.stellar.javastellarsdkdemoapp.ui.theme.JavaStellarSDKDemoAppTheme +import org.stellar.sdk.Account +import org.stellar.sdk.AccountConverter +import org.stellar.sdk.Address +import org.stellar.sdk.Auth +import org.stellar.sdk.InvokeHostFunctionOperation +import org.stellar.sdk.KeyPair +import org.stellar.sdk.Network import org.stellar.sdk.Server +import org.stellar.sdk.SorobanServer +import org.stellar.sdk.TimeBounds +import org.stellar.sdk.Transaction +import org.stellar.sdk.TransactionBuilder +import org.stellar.sdk.TransactionPreconditions +import org.stellar.sdk.federation.FederationServer +import org.stellar.sdk.scval.Scv +import org.stellar.sdk.xdr.ContractExecutable +import org.stellar.sdk.xdr.ContractExecutableType +import org.stellar.sdk.xdr.ContractIDPreimage +import org.stellar.sdk.xdr.ContractIDPreimage.ContractIDPreimageFromAddress +import org.stellar.sdk.xdr.ContractIDPreimageType +import org.stellar.sdk.xdr.CreateContractArgs +import org.stellar.sdk.xdr.ExtensionPoint +import org.stellar.sdk.xdr.HostFunction +import org.stellar.sdk.xdr.HostFunctionType +import org.stellar.sdk.xdr.Int64 +import org.stellar.sdk.xdr.InvokeContractArgs +import org.stellar.sdk.xdr.LedgerEntryType +import org.stellar.sdk.xdr.LedgerFootprint +import org.stellar.sdk.xdr.LedgerKey +import org.stellar.sdk.xdr.LedgerKey.LedgerKeyAccount +import org.stellar.sdk.xdr.SorobanAddressCredentials +import org.stellar.sdk.xdr.SorobanAuthorizationEntry +import org.stellar.sdk.xdr.SorobanAuthorizedFunction +import org.stellar.sdk.xdr.SorobanAuthorizedFunctionType +import org.stellar.sdk.xdr.SorobanAuthorizedInvocation +import org.stellar.sdk.xdr.SorobanCredentials +import org.stellar.sdk.xdr.SorobanCredentialsType +import org.stellar.sdk.xdr.SorobanResources +import org.stellar.sdk.xdr.SorobanTransactionData +import org.stellar.sdk.xdr.Uint256 +import org.stellar.sdk.xdr.Uint32 +import org.stellar.sdk.xdr.XdrUnsignedInteger -private const val HORIZON_SERVER = "https://horizon.stellar.org/" -private const val PUBLIC = "Public Global Stellar Network ; September 2015" -private const val TESTNET = "Test SDF Network ; September 2015" class MainActivity : ComponentActivity() { - private lateinit var networkViewModel: NetworkViewModel + private lateinit var sdkTestViewModel: SdkTestViewModel override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - networkViewModel = ViewModelProvider(this).get(NetworkViewModel::class.java) + sdkTestViewModel = ViewModelProvider(this).get(SdkTestViewModel::class.java) setContent { JavaStellarSDKDemoAppTheme { @@ -46,43 +85,43 @@ class MainActivity : ComponentActivity() { modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { - Main(networkViewModel) + Main(sdkTestViewModel) } } } } } -class NetworkViewModel : ViewModel() { - private val _network = mutableStateOf(null) - val network: String? get() = _network.value +class SdkTestViewModel : ViewModel() { + private val _result = mutableStateOf(null) + val result: String? get() = _result.value - fun fetchNetworkPassphrase() { + fun runSDKTest() { viewModelScope.launch { - _network.value = withContext(Dispatchers.IO) { - getNetwork() + _result.value = withContext(Dispatchers.IO) { + testSDK() } } } } @Composable -fun Main(networkViewModel: NetworkViewModel, modifier: Modifier = Modifier) { +fun Main(sdkTestViewModel: SdkTestViewModel, modifier: Modifier = Modifier) { Column( modifier = modifier.fillMaxSize(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { Button( - onClick = { networkViewModel.fetchNetworkPassphrase() } + onClick = { sdkTestViewModel.runSDKTest() } ) { - Text(text = "Get Network") + Text(text = "Run Test") } Spacer(modifier = Modifier.height(16.dp)) Text( - text = networkViewModel.network ?: "No network info", + text = sdkTestViewModel.result ?: "Not Run", modifier = Modifier.padding(horizontal = 16.dp) ) } @@ -92,28 +131,167 @@ fun Main(networkViewModel: NetworkViewModel, modifier: Modifier = Modifier) { @Composable fun MainPreview() { JavaStellarSDKDemoAppTheme { - val networkViewModel = NetworkViewModel() - Main(networkViewModel) + val sdkTestViewModel = SdkTestViewModel() + Main(sdkTestViewModel) } } -private fun getNetwork(): String? { - val server = Server(HORIZON_SERVER) +private fun testSDK(): String { return try { - when (server.root().networkPassphrase) { - PUBLIC -> { - "public" - } + // send request to horizon server + val server = Server("https://horizon.stellar.org") + val horizonResp = server.root() + if (horizonResp == null || horizonResp.networkPassphrase != Network.PUBLIC.networkPassphrase) { + throw Exception("Query Horizon failed") + } - TESTNET -> { - "testnet" - } + // send request to Soroban RPC server + val sorobanServer = SorobanServer("https://soroban-testnet.stellar.org:443") + if (sorobanServer.network.passphrase != Network.TESTNET.networkPassphrase) { + throw Exception("Query Soroban Server failed") + } - else -> { - "others" - } + // Test Federation + val fedResp = + FederationServer.createForDomain("lobstr.co").resolveAddress("example*lobstr.co") + if (fedResp == null || fedResp.accountId == null) { + throw Exception("Query Federation failed") + } + + // build and parse transaction + val source: KeyPair = + KeyPair.fromSecretSeed("SCH27VUZZ6UAKB67BDNF6FA42YMBMQCBKXWGMFD5TZ6S5ZZCZFLRXKHS") + + val ledgerKey = LedgerKey.Builder() + .discriminant(LedgerEntryType.ACCOUNT) + .account( + LedgerKeyAccount.Builder() + .accountID( + KeyPair.fromAccountId( + "GB7TAYRUZGE6TVT7NHP5SMIZRNQA6PLM423EYISAOAP3MKYIQMVYP2JO" + ) + .xdrAccountId + ) + .build() + ) + .build() + val sorobanData = SorobanTransactionData.Builder() + .resources( + SorobanResources.Builder() + .footprint( + LedgerFootprint.Builder() + .readOnly(arrayOf(ledgerKey)) + .readWrite(arrayOf()) + .build() + ) + .readBytes(Uint32(XdrUnsignedInteger(699))) + .writeBytes(Uint32(XdrUnsignedInteger(0))) + .instructions(Uint32(XdrUnsignedInteger(34567))) + .build() + ) + .refundableFee(Int64(100L)) + .ext(ExtensionPoint.Builder().discriminant(0).build()) + .build() + val sorobanDataString = sorobanData.toXdrBase64() + + val createContractArgs = CreateContractArgs.Builder() + .contractIDPreimage( + ContractIDPreimage.Builder() + .discriminant(ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ADDRESS) + .fromAddress( + ContractIDPreimageFromAddress.Builder() + .address( + Address( + "GB7TAYRUZGE6TVT7NHP5SMIZRNQA6PLM423EYISAOAP3MKYIQMVYP2JO" + ) + .toSCAddress() + ) + .salt(Uint256(ByteArray(32))) + .build() + ) + .build() + ) + .executable( + ContractExecutable.Builder() + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .build() + ) + .build() + val hostFunction = HostFunction.Builder() + .discriminant(HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT) + .createContract(createContractArgs) + .build() + val invokeHostFunctionOperation = + InvokeHostFunctionOperation.builder().hostFunction(hostFunction).build() + + val sequenceNumber = 2908908335136768L + val account = Account(source.accountId, sequenceNumber) + val transaction: Transaction = + TransactionBuilder(AccountConverter.enableMuxed(), account, Network.TESTNET) + .addOperation(invokeHostFunctionOperation) + .addPreconditions( + TransactionPreconditions.builder().timeBounds(TimeBounds(0, 0)).build() + ) + .setBaseFee(100) + .setSorobanData(sorobanDataString) + .build() + transaction.sign(source) + Transaction.fromEnvelopeXdr(transaction.toEnvelopeXdrBase64(), Network.TESTNET) + + // sign entry + val contractId = "CDCYWK73YTYFJZZSJ5V7EDFNHYBG4QN3VUNG2IGD27KJDDPNCZKBCBXK" + val signer = + KeyPair.fromSecretSeed("SAEZSI6DY7AXJFIYA4PM6SIBNEYYXIEM2MSOTHFGKHDW32MBQ7KVO6EN") + val validUntilLedgerSeq = 654656L + val network = Network.TESTNET + + val credentials = SorobanCredentials.Builder() + .discriminant(SorobanCredentialsType.SOROBAN_CREDENTIALS_ADDRESS) + .address( + SorobanAddressCredentials.Builder() + .address(Address(signer.accountId).toSCAddress()) + .nonce(Int64(123456789L)) + .signatureExpirationLedger(Uint32(XdrUnsignedInteger(0L))) + .signature(Scv.toVoid()) + .build() + ) + .build() + val invocation = SorobanAuthorizedInvocation.Builder() + .function( + SorobanAuthorizedFunction.Builder() + .discriminant( + SorobanAuthorizedFunctionType.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN + ) + .contractFn( + InvokeContractArgs.Builder() + .contractAddress(Address(contractId).toSCAddress()) + .functionName(Scv.toSymbol("increment").sym) + .args(arrayOfNulls(0)) + .build() + ) + .build() + ) + .subInvocations(arrayOfNulls(0)) + .build() + val entry = SorobanAuthorizationEntry.Builder() + .credentials(credentials) + .rootInvocation(invocation) + .build() + Auth.authorizeEntry(entry.toXdrBase64(), signer, validUntilLedgerSeq, network) + + // send real transaction + // https://horizon.stellar.org/transactions/fe833c504ca8b329c1e00adec7da79f61a55e28dc705e22a6515494427cc456a + val xdr = + "AAAAAgAAAAAcBaQEwcGuB3ErX1lnwKcP/pe84KcAabwB0GNk6SNvnwAAnQgCwi0TAAgJjwAAAAEAAAAAAAAAAAAAAABlD7HrAAAAAAAAAAIAAAAAAAAADAAAAAAAAAACZUJvbmQAAAAAAAAAAAAAAN80PsIQ9ohJQb1yLu4XaURrKURt5rbLoC7FfOM4vSZQAAAH0oBPrQsAAABFAB6EgAAAAABRAwlNAAAAAAAAAAwAAAAAAAAAAmVCb25kAAAAAAAAAAAAAADfND7CEPaISUG9ci7uF2lEaylEbea2y6AuxXzjOL0mUAAAByOt/5PHAAAAvQBMS0AAAAAAUQMJTgAAAAAAAAAB6SNvnwAAAEDR4cJo3zzZfCFusnM0sECT4xmhLW/bgwukIBxWWXvsDGLdQtE87lkrGijAPiyBEy3n1lDxDu4uwNpGnMXEaTAN" + val tx: Transaction = Transaction.fromEnvelopeXdr(xdr, Network.PUBLIC) as Transaction + val resp = server.submitTransaction(tx) + if (!resp.isSuccess) { + throw Exception("Submit transaction failed") } + + "SUCCESS" } catch (e: Exception) { - null + Log.e("MainActivity", "testSDK ERROR", e) + "FAILED" } } \ No newline at end of file diff --git a/android_test/app/src/main/res/drawable/ic_launcher_foreground.xml b/android_test/app/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from android_test/app/src/main/res/drawable/ic_launcher_foreground.xml rename to android_test/app/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/android_test/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/android_test/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from android_test/app/src/main/res/mipmap-anydpi/ic_launcher.xml rename to android_test/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/android_test/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/android_test/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from android_test/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml rename to android_test/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/android_test/app/src/main/resources/META-INF/services/org.stellar.sdk.spi.SdkProvider b/android_test/app/src/main/resources/META-INF/services/org.stellar.sdk.spi.SdkProvider new file mode 100644 index 000000000..e56de0fc0 --- /dev/null +++ b/android_test/app/src/main/resources/META-INF/services/org.stellar.sdk.spi.SdkProvider @@ -0,0 +1 @@ +org.stellar.javastellarsdkdemoapp.AndroidSdkProvider \ No newline at end of file diff --git a/android_test/settings.gradle.kts b/android_test/settings.gradle.kts index 756213d0f..83bd517df 100644 --- a/android_test/settings.gradle.kts +++ b/android_test/settings.gradle.kts @@ -10,6 +10,7 @@ dependencyResolutionManagement { repositories { google() mavenCentral() + maven { url = uri("https://jitpack.io") } } } diff --git a/readme.md b/readme.md index 691447b16..25f7e8a2e 100644 --- a/readme.md +++ b/readme.md @@ -33,6 +33,10 @@ For some examples on how to use this library, take a look at the [Get Started do ## Documentation Javadoc is available at https://stellar.github.io/java-stellar-sdk +## Integrate into Android project +If you want to integrate this SDK on Android platforms with API level 26 and above, you don't need any additional configuration. +However, if you need to include it on lower platforms, you may also need to add the [Java Stellar SDK Android SPI](https://github.com/stellar/java-stellar-sdk-android-spi). + ## Contributing For information on how to contribute, please refer to our [contribution guide](https://github.com/stellar/java-stellar-sdk/blob/master/CONTRIBUTING.md). diff --git a/src/main/java/org/stellar/sdk/ApacheBase32.java b/src/main/java/org/stellar/sdk/ApacheBase32.java new file mode 100644 index 000000000..0f878925d --- /dev/null +++ b/src/main/java/org/stellar/sdk/ApacheBase32.java @@ -0,0 +1,23 @@ +package org.stellar.sdk; + +/** Default implementation of {@link Base32} using the Apache Commons Codec. */ +class ApacheBase32 implements Base32 { + // org.apache.commons.codec.binary.Base32 is thread-safe. + private final org.apache.commons.codec.binary.Base32 base32 = + new org.apache.commons.codec.binary.Base32(); + + @Override + public byte[] encode(byte[] data) { + return base32.encode(data); + } + + @Override + public byte[] decode(String data) { + return base32.decode(data); + } + + @Override + public byte[] decode(byte[] data) { + return base32.decode(data); + } +} diff --git a/src/main/java/org/stellar/sdk/Base32.java b/src/main/java/org/stellar/sdk/Base32.java new file mode 100644 index 000000000..fc8c41d6e --- /dev/null +++ b/src/main/java/org/stellar/sdk/Base32.java @@ -0,0 +1,29 @@ +package org.stellar.sdk; + +/** Base32 interface used by the SDK to encode and decode strings and bytes. */ +public interface Base32 { + + /** + * Encodes bytes to base32 bytes + * + * @param data bytes to encode + * @return encoded bytes + */ + byte[] encode(byte[] data); + + /** + * Decodes base32 string to bytes + * + * @param data string to decode + * @return decoded bytes + */ + byte[] decode(String data); + + /** + * Decodes base32 bytes to bytes + * + * @param data bytes to decode + * @return decoded bytes + */ + byte[] decode(byte[] data); +} diff --git a/src/main/java/org/stellar/sdk/Base32Factory.java b/src/main/java/org/stellar/sdk/Base32Factory.java new file mode 100644 index 000000000..dfb2f86b2 --- /dev/null +++ b/src/main/java/org/stellar/sdk/Base32Factory.java @@ -0,0 +1,29 @@ +package org.stellar.sdk; + +import java.util.Iterator; +import java.util.ServiceLoader; +import lombok.Getter; +import org.stellar.sdk.spi.SdkProvider; + +/** + * Factory class used to create {@link Base32} instances. + * + *

The class will try to load an implementation of {@link Base32} using the {@link + * ServiceLoader}, if no implementation is found it will use the default implementation {@link + * ApacheBase32}. + */ +class Base32Factory { + @Getter private static Base32 instance = new ApacheBase32(); + + static { + ServiceLoader load = ServiceLoader.load(SdkProvider.class); + Iterator iterator = load.iterator(); + if (iterator.hasNext()) { + SdkProvider sdkProvider = iterator.next(); + Base32 newInstance = sdkProvider.createBase32(); + if (newInstance != null) { + instance = newInstance; + } + } + } +} diff --git a/src/main/java/org/stellar/sdk/Base64.java b/src/main/java/org/stellar/sdk/Base64.java new file mode 100644 index 000000000..459ebd686 --- /dev/null +++ b/src/main/java/org/stellar/sdk/Base64.java @@ -0,0 +1,28 @@ +package org.stellar.sdk; + +/** Base64 interface used by the SDK to encode and decode strings and bytes. */ +public interface Base64 { + /** + * Encodes bytes to base64 string + * + * @param data bytes to encode + * @return encoded string + */ + String encodeToString(byte[] data); + + /** + * Encodes bytes to base64 bytes + * + * @param data bytes to encode + * @return encoded bytes + */ + byte[] encode(byte[] data); + + /** + * Decodes base64 string to bytes + * + * @param data string to decode + * @return decoded bytes + */ + byte[] decode(String data); +} diff --git a/src/main/java/org/stellar/sdk/Base64Factory.java b/src/main/java/org/stellar/sdk/Base64Factory.java new file mode 100644 index 000000000..ca6f7926d --- /dev/null +++ b/src/main/java/org/stellar/sdk/Base64Factory.java @@ -0,0 +1,31 @@ +package org.stellar.sdk; + +import java.util.Iterator; +import java.util.ServiceLoader; +import lombok.Getter; +import org.stellar.sdk.spi.SdkProvider; + +/** + * Factory class used to create {@link Base64} instances. + * + *

The class will try to load an implementation of {@link Base64} using the {@link + * ServiceLoader}, if no implementation is found it will use the default implementation {@link + * JDKBase64}. + * + *

Note: The class should be limited to internal use only, and users should not use it directly. + */ +public class Base64Factory { + @Getter private static Base64 instance = new JDKBase64(); + + static { + ServiceLoader load = ServiceLoader.load(SdkProvider.class); + Iterator iterator = load.iterator(); + if (iterator.hasNext()) { + SdkProvider sdkProvider = iterator.next(); + Base64 newInstance = sdkProvider.createBase64(); + if (newInstance != null) { + instance = newInstance; + } + } + } +} diff --git a/src/main/java/org/stellar/sdk/JDKBase64.java b/src/main/java/org/stellar/sdk/JDKBase64.java new file mode 100644 index 000000000..297a477be --- /dev/null +++ b/src/main/java/org/stellar/sdk/JDKBase64.java @@ -0,0 +1,19 @@ +package org.stellar.sdk; + +/** Default implementation of {@link Base64} using the JDK's {@link java.util.Base64}. */ +class JDKBase64 implements Base64 { + @Override + public String encodeToString(byte[] data) { + return java.util.Base64.getEncoder().encodeToString(data); + } + + @Override + public byte[] encode(byte[] data) { + return java.util.Base64.getEncoder().encode(data); + } + + @Override + public byte[] decode(String data) { + return java.util.Base64.getDecoder().decode(data); + } +} diff --git a/src/main/java/org/stellar/sdk/Sep10Challenge.java b/src/main/java/org/stellar/sdk/Sep10Challenge.java index a47526b75..03e01f7fe 100644 --- a/src/main/java/org/stellar/sdk/Sep10Challenge.java +++ b/src/main/java/org/stellar/sdk/Sep10Challenge.java @@ -5,7 +5,6 @@ import java.security.SecureRandom; import java.util.ArrayList; import java.util.Arrays; -import java.util.Base64; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -84,7 +83,7 @@ public static Transaction newChallenge( byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = Base64Factory.getInstance().encode(nonce); if (clientDomain.isEmpty() != clientSigningKey.isEmpty()) { throw new InvalidSep10ChallengeException( @@ -310,7 +309,7 @@ public static ChallengeTransaction readChallengeTransaction( byte[] nonce; try { - nonce = Base64.getDecoder().decode(new String(manageDataOperation.getValue())); + nonce = Base64Factory.getInstance().decode(new String(manageDataOperation.getValue())); } catch (IllegalArgumentException e) { throw new InvalidSep10ChallengeException( "Failed to decode random nonce provided in ManageData operation.", e); diff --git a/src/main/java/org/stellar/sdk/StrKey.java b/src/main/java/org/stellar/sdk/StrKey.java index dceabd206..ce8f5ad63 100644 --- a/src/main/java/org/stellar/sdk/StrKey.java +++ b/src/main/java/org/stellar/sdk/StrKey.java @@ -3,11 +3,9 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Optional; -import org.apache.commons.codec.binary.Base32; -import org.apache.commons.codec.binary.Base32OutputStream; -import org.apache.commons.codec.binary.StringUtils; import org.stellar.sdk.xdr.AccountID; import org.stellar.sdk.xdr.CryptoKeyType; import org.stellar.sdk.xdr.MuxedAccount; @@ -24,7 +22,7 @@ class StrKey { public static final int ACCOUNT_ID_ADDRESS_LENGTH = 56; private static final byte[] b32Table = decodingTable(); - private static final Base32 base32Codec = new Base32(); + private static final Base32 base32Codec = Base32Factory.getInstance(); public static String encodeContractId(byte[] data) { char[] encoded = encodeCheck(VersionByte.CONTRACT, data); @@ -140,7 +138,7 @@ public static MuxedAccount encodeToXDRMuxedAccount(String data) { } public static VersionByte decodeVersionByte(String data) { - byte[] dataBytes = StringUtils.getBytesUtf8(data); + byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8); byte[] decoded = base32decode(dataBytes); byte decodedVersionByte = decoded[0]; Optional versionByteOptional = VersionByte.findByValue(decodedVersionByte); @@ -238,35 +236,21 @@ protected static char[] encodeCheck(VersionByte versionByte, byte[] data) { outputStream.write(checksum); byte[] unencoded = outputStream.toByteArray(); - if (VersionByte.SEED != versionByte) { - return bytesToChars(removeBase32Padding(base32Codec.encode(unencoded))); - } - - // Why not use base32Codec.encode here? - // We don't want secret seed to be stored as String in memory because of security reasons. - // It's impossible - // to erase it from memory when we want it to be erased (ASAP). - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(unencoded.length); - Base32OutputStream base32OutputStream = new Base32OutputStream(byteArrayOutputStream); - base32OutputStream.write(unencoded); - base32OutputStream.close(); - - byte[] encodedBytes = byteArrayOutputStream.toByteArray(); + byte[] encodedBytes = base32Codec.encode(unencoded); byte[] unpaddedEncodedBytes = removeBase32Padding(encodedBytes); char[] charsEncoded = bytesToChars(unpaddedEncodedBytes); + if (VersionByte.SEED != versionByte) { + return charsEncoded; + } + + // Erase all data from memory Arrays.fill(unencoded, (byte) 0); Arrays.fill(payload, (byte) 0); Arrays.fill(checksum, (byte) 0); Arrays.fill(encodedBytes, (byte) 0); Arrays.fill(unpaddedEncodedBytes, (byte) 0); - // Clean byteArrayOutputStream internal buffer - int size = byteArrayOutputStream.size(); - byteArrayOutputStream.reset(); - byteArrayOutputStream.write(new byte[size]); - byteArrayOutputStream.close(); - return charsEncoded; } catch (IOException e) { throw new AssertionError(e); @@ -430,9 +414,18 @@ private static char[] bytesToChars(byte[] data) { private static byte[] base32decode(byte[] data) { // Apache commons codec Base32 class will auto remove the illegal characters, this is // what we don't want, so we need to check the data before decoding - if (!base32Codec.isInAlphabet(data, false)) { + if (!isInAlphabet(data)) { throw new IllegalArgumentException("Invalid base32 encoded string"); } return base32Codec.decode(data); } + + private static boolean isInAlphabet(final byte[] arrayOctet) { + for (final byte octet : arrayOctet) { + if (!(octet >= 0 && octet < b32Table.length && b32Table[octet] != -1)) { + return false; + } + } + return true; + } } diff --git a/src/main/java/org/stellar/sdk/responses/AccountResponse.java b/src/main/java/org/stellar/sdk/responses/AccountResponse.java index 3aa672629..aa9e4437d 100644 --- a/src/main/java/org/stellar/sdk/responses/AccountResponse.java +++ b/src/main/java/org/stellar/sdk/responses/AccountResponse.java @@ -3,11 +3,11 @@ import static org.stellar.sdk.Asset.create; import com.google.gson.annotations.SerializedName; -import java.util.Base64; import java.util.HashMap; import java.util.Optional; import lombok.NonNull; import org.stellar.sdk.Asset; +import org.stellar.sdk.Base64Factory; import org.stellar.sdk.KeyPair; import org.stellar.sdk.LiquidityPoolID; @@ -440,7 +440,7 @@ public String get(String key) { * @return raw value */ public byte[] getDecoded(String key) { - return Base64.getDecoder().decode(this.get(key)); + return Base64Factory.getInstance().decode(this.get(key)); } } diff --git a/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java b/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java index 9f977f214..e7f5a5269 100644 --- a/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java +++ b/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java @@ -4,8 +4,8 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.Base64; import java.util.Optional; +import org.stellar.sdk.Base64Factory; import org.stellar.sdk.Server; import org.stellar.sdk.xdr.OperationResult; import org.stellar.sdk.xdr.OperationType; @@ -151,7 +151,7 @@ public Optional getDecodedTransactionResult() throws IOExcept if (!resultXDR.isPresent()) { return Optional.empty(); } - byte[] bytes = Base64.getDecoder().decode(resultXDR.get()); + byte[] bytes = Base64Factory.getInstance().decode(resultXDR.get()); ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); XdrDataInputStream xdrInputStream = new XdrDataInputStream(inputStream); this.transactionResult = TransactionResult.decode(xdrInputStream); diff --git a/src/main/java/org/stellar/sdk/responses/TransactionDeserializer.java b/src/main/java/org/stellar/sdk/responses/TransactionDeserializer.java index 9faf0d2df..648e1f772 100644 --- a/src/main/java/org/stellar/sdk/responses/TransactionDeserializer.java +++ b/src/main/java/org/stellar/sdk/responses/TransactionDeserializer.java @@ -5,7 +5,7 @@ import java.io.IOException; import java.lang.reflect.Type; import java.math.BigInteger; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; import org.stellar.sdk.Memo; import org.stellar.sdk.xdr.TransactionEnvelope; import org.stellar.sdk.xdr.XdrDataInputStream; @@ -54,19 +54,18 @@ public TransactionResponse deserialize( // representation of a transaction. That's why we need to handle a special case // here. if (memoType.equals("text")) { - Base64.Decoder base64Decoder = Base64.getDecoder(); JsonObject jsonResponse = json.getAsJsonObject(); if (jsonResponse.has("memo_bytes")) { // we obtain the memo text from the "memo_bytes" field because the original byte sequence // may not be valid utf8 String memoBase64 = json.getAsJsonObject().get("memo_bytes").getAsString(); - memo = Memo.text(base64Decoder.decode(memoBase64)); + memo = Memo.text(Base64Factory.getInstance().decode(memoBase64)); } else { // memo_bytes is not available because horizon is running a version older than 1.2.0 // so we will recover the bytes from the xdr String envelopeXdr = json.getAsJsonObject().get("envelope_xdr").getAsString(); - byte[] bytes = base64Decoder.decode(envelopeXdr); + byte[] bytes = Base64Factory.getInstance().decode(envelopeXdr); TransactionEnvelope transactionEnvelope = null; try { transactionEnvelope = @@ -80,13 +79,12 @@ public TransactionResponse deserialize( } } else { String memoValue = json.getAsJsonObject().get("memo").getAsString(); - Base64.Decoder base64Decoder = Base64.getDecoder(); if (memoType.equals("id")) { memo = Memo.id(new BigInteger(memoValue)); } else if (memoType.equals("hash")) { - memo = Memo.hash(base64Decoder.decode(memoValue)); + memo = Memo.hash(Base64Factory.getInstance().decode(memoValue)); } else if (memoType.equals("return")) { - memo = Memo.returnHash(base64Decoder.decode(memoValue)); + memo = Memo.returnHash(Base64Factory.getInstance().decode(memoValue)); } else { throw new JsonParseException("Unknown memo type."); } diff --git a/src/main/java/org/stellar/sdk/spi/SdkProvider.java b/src/main/java/org/stellar/sdk/spi/SdkProvider.java new file mode 100644 index 000000000..dcd7986fd --- /dev/null +++ b/src/main/java/org/stellar/sdk/spi/SdkProvider.java @@ -0,0 +1,48 @@ +package org.stellar.sdk.spi; + +import org.stellar.sdk.Base32; +import org.stellar.sdk.Base64; + +/** + * An abstract class for service providers that provide implementations of the SDK. + * + *

Note: we offer an Android specific implementation of this class, see Java Stellar SDK Android SPI. + * + * @see Service Provider + * Interfaces + */ +public interface SdkProvider { + + /** + * Creates a {@link Base64} implementation that will be used by the SDK. + * + *

Note: Default implementation will use the JDK's {@link java.util.Base64}, and it only works + * with Android API 26 and above, if you need to support older versions of Android you need to + * provide your own implementation, this + * is an example for reference. + * + * @return a {@link Base64} implementation, if returns null the SDK will use the default + * implementation. + */ + default Base64 createBase64() { + return null; + } + + /** + * Creates a {@link Base32} implementation that will be used by the SDK. + * + *

Note: Default implementation will use the Apache Commons Codec's {@link + * org.apache.commons.codec.binary.Base32}, and it only works with Android API 28 and above, if + * you need to support older versions of Android you need to provide your own implementation, this + * is an example for reference. + * + * @return a {@link Base32} implementation, if returns null the SDK will use the default + * implementation. + */ + default Base32 createBase32() { + return null; + } +} diff --git a/src/main/java/org/stellar/sdk/xdr/AccountEntry.java b/src/main/java/org/stellar/sdk/xdr/AccountEntry.java index f72f77fe0..c9b359031 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountEntry.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -232,7 +232,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -244,7 +244,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -426,7 +426,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -438,7 +438,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV1.java b/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV1.java index ee43a5559..904daf1dc 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV1.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV1.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntryExtensionV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -227,7 +227,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -239,7 +239,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntryExtensionV1Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV2.java b/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV2.java index 1a87cd4e8..565bc925e 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV2.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV2.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -126,7 +126,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -138,7 +138,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntryExtensionV2 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -280,7 +280,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -292,7 +292,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntryExtensionV2Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV3.java b/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV3.java index d6c54dca4..c1aed1cc7 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV3.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV3.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -99,7 +99,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -111,7 +111,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountEntryExtensionV3 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountFlags.java b/src/main/java/org/stellar/sdk/xdr/AccountFlags.java index b1b7bb8fd..23187e9eb 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountFlags.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountFlags.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountFlags fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountID.java b/src/main/java/org/stellar/sdk/xdr/AccountID.java index 554de2924..2f7982405 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountID.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountID.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountMergeResult.java b/src/main/java/org/stellar/sdk/xdr/AccountMergeResult.java index 91beb0805..e74d189fe 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountMergeResult.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountMergeResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -135,7 +135,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -147,7 +147,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountMergeResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AccountMergeResultCode.java b/src/main/java/org/stellar/sdk/xdr/AccountMergeResultCode.java index 65222dfb7..ec6bbbde7 100644 --- a/src/main/java/org/stellar/sdk/xdr/AccountMergeResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/AccountMergeResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -83,7 +83,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -95,7 +95,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AccountMergeResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AllowTrustOp.java b/src/main/java/org/stellar/sdk/xdr/AllowTrustOp.java index ae10e0d27..98b6d28f4 100644 --- a/src/main/java/org/stellar/sdk/xdr/AllowTrustOp.java +++ b/src/main/java/org/stellar/sdk/xdr/AllowTrustOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -94,7 +94,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -106,7 +106,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AllowTrustOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AllowTrustResult.java b/src/main/java/org/stellar/sdk/xdr/AllowTrustResult.java index a492b1f5f..a904b563d 100644 --- a/src/main/java/org/stellar/sdk/xdr/AllowTrustResult.java +++ b/src/main/java/org/stellar/sdk/xdr/AllowTrustResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -112,7 +112,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -124,7 +124,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AllowTrustResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AllowTrustResultCode.java b/src/main/java/org/stellar/sdk/xdr/AllowTrustResultCode.java index 801a1206b..84e457051 100644 --- a/src/main/java/org/stellar/sdk/xdr/AllowTrustResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/AllowTrustResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -80,7 +80,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -92,7 +92,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AllowTrustResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AlphaNum12.java b/src/main/java/org/stellar/sdk/xdr/AlphaNum12.java index 464a309ba..77116cb77 100644 --- a/src/main/java/org/stellar/sdk/xdr/AlphaNum12.java +++ b/src/main/java/org/stellar/sdk/xdr/AlphaNum12.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AlphaNum12 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AlphaNum4.java b/src/main/java/org/stellar/sdk/xdr/AlphaNum4.java index 4bed6e0df..e91ea85c6 100644 --- a/src/main/java/org/stellar/sdk/xdr/AlphaNum4.java +++ b/src/main/java/org/stellar/sdk/xdr/AlphaNum4.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AlphaNum4 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Asset.java b/src/main/java/org/stellar/sdk/xdr/Asset.java index bcb446458..cd43e7f6f 100644 --- a/src/main/java/org/stellar/sdk/xdr/Asset.java +++ b/src/main/java/org/stellar/sdk/xdr/Asset.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -146,7 +146,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -158,7 +158,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Asset fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AssetCode.java b/src/main/java/org/stellar/sdk/xdr/AssetCode.java index 641cade63..f64406ea7 100644 --- a/src/main/java/org/stellar/sdk/xdr/AssetCode.java +++ b/src/main/java/org/stellar/sdk/xdr/AssetCode.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -140,7 +140,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -152,7 +152,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AssetCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AssetCode12.java b/src/main/java/org/stellar/sdk/xdr/AssetCode12.java index 8a2be4c92..6acc34240 100644 --- a/src/main/java/org/stellar/sdk/xdr/AssetCode12.java +++ b/src/main/java/org/stellar/sdk/xdr/AssetCode12.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AssetCode12 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AssetCode4.java b/src/main/java/org/stellar/sdk/xdr/AssetCode4.java index e83cf0a97..99c33460f 100644 --- a/src/main/java/org/stellar/sdk/xdr/AssetCode4.java +++ b/src/main/java/org/stellar/sdk/xdr/AssetCode4.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AssetCode4 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AssetType.java b/src/main/java/org/stellar/sdk/xdr/AssetType.java index 30771b3f0..884dc712a 100644 --- a/src/main/java/org/stellar/sdk/xdr/AssetType.java +++ b/src/main/java/org/stellar/sdk/xdr/AssetType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -63,7 +63,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -75,7 +75,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AssetType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Auth.java b/src/main/java/org/stellar/sdk/xdr/Auth.java index ce1ead623..737f25001 100644 --- a/src/main/java/org/stellar/sdk/xdr/Auth.java +++ b/src/main/java/org/stellar/sdk/xdr/Auth.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -63,7 +63,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -75,7 +75,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Auth fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AuthCert.java b/src/main/java/org/stellar/sdk/xdr/AuthCert.java index 1f9db9ebf..f21d67b73 100644 --- a/src/main/java/org/stellar/sdk/xdr/AuthCert.java +++ b/src/main/java/org/stellar/sdk/xdr/AuthCert.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -92,7 +92,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -104,7 +104,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AuthCert fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/AuthenticatedMessage.java b/src/main/java/org/stellar/sdk/xdr/AuthenticatedMessage.java index 26f50cae2..3ac0c5883 100644 --- a/src/main/java/org/stellar/sdk/xdr/AuthenticatedMessage.java +++ b/src/main/java/org/stellar/sdk/xdr/AuthenticatedMessage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -117,7 +117,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -129,7 +129,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AuthenticatedMessage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -211,7 +211,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -223,7 +223,7 @@ public byte[] toXdrByteArray() throws IOException { } public static AuthenticatedMessageV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesOp.java b/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesOp.java index 9c9a7ce01..75c4db64c 100644 --- a/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesOp.java +++ b/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BeginSponsoringFutureReservesOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResult.java b/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResult.java index 127dcd520..3af887e4b 100644 --- a/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResult.java +++ b/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -109,7 +109,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -121,7 +121,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BeginSponsoringFutureReservesResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResultCode.java b/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResultCode.java index 8f9a8a1f3..cd830efed 100644 --- a/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/BeginSponsoringFutureReservesResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -82,7 +82,7 @@ public byte[] toXdrByteArray() throws IOException { public static BeginSponsoringFutureReservesResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BucketEntry.java b/src/main/java/org/stellar/sdk/xdr/BucketEntry.java index 872c372f4..87202560d 100644 --- a/src/main/java/org/stellar/sdk/xdr/BucketEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/BucketEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -167,7 +167,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -179,7 +179,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BucketEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BucketEntryType.java b/src/main/java/org/stellar/sdk/xdr/BucketEntryType.java index 359a29b2b..b565325cc 100644 --- a/src/main/java/org/stellar/sdk/xdr/BucketEntryType.java +++ b/src/main/java/org/stellar/sdk/xdr/BucketEntryType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BucketEntryType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BucketMetadata.java b/src/main/java/org/stellar/sdk/xdr/BucketMetadata.java index 9a0f8eddf..03dbb501d 100644 --- a/src/main/java/org/stellar/sdk/xdr/BucketMetadata.java +++ b/src/main/java/org/stellar/sdk/xdr/BucketMetadata.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -86,7 +86,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -98,7 +98,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BucketMetadata fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -201,7 +201,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -213,7 +213,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BucketMetadataExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java index 14155f454..de76ffe54 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java +++ b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BumpFootprintExpirationOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java index 3212a44ac..c060f8baf 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java +++ b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -107,7 +107,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -119,7 +119,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BumpFootprintExpirationResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java index b55ae1e36..d51f65ef0 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BumpFootprintExpirationResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpSequenceOp.java b/src/main/java/org/stellar/sdk/xdr/BumpSequenceOp.java index 4602afec0..7acdeb210 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpSequenceOp.java +++ b/src/main/java/org/stellar/sdk/xdr/BumpSequenceOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BumpSequenceOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpSequenceResult.java b/src/main/java/org/stellar/sdk/xdr/BumpSequenceResult.java index 750d061ca..eea05eace 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpSequenceResult.java +++ b/src/main/java/org/stellar/sdk/xdr/BumpSequenceResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -97,7 +97,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -109,7 +109,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BumpSequenceResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpSequenceResultCode.java b/src/main/java/org/stellar/sdk/xdr/BumpSequenceResultCode.java index 363656d28..230865717 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpSequenceResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/BumpSequenceResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -58,7 +58,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -70,7 +70,7 @@ public byte[] toXdrByteArray() throws IOException { } public static BumpSequenceResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ChangeTrustAsset.java b/src/main/java/org/stellar/sdk/xdr/ChangeTrustAsset.java index 02e2ff442..b1692d2a4 100644 --- a/src/main/java/org/stellar/sdk/xdr/ChangeTrustAsset.java +++ b/src/main/java/org/stellar/sdk/xdr/ChangeTrustAsset.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -174,7 +174,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -186,7 +186,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ChangeTrustAsset fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ChangeTrustOp.java b/src/main/java/org/stellar/sdk/xdr/ChangeTrustOp.java index c4c467d69..cc822bbd3 100644 --- a/src/main/java/org/stellar/sdk/xdr/ChangeTrustOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ChangeTrustOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ChangeTrustOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ChangeTrustResult.java b/src/main/java/org/stellar/sdk/xdr/ChangeTrustResult.java index 8a3422f07..a05556967 100644 --- a/src/main/java/org/stellar/sdk/xdr/ChangeTrustResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ChangeTrustResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -118,7 +118,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -130,7 +130,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ChangeTrustResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ChangeTrustResultCode.java b/src/main/java/org/stellar/sdk/xdr/ChangeTrustResultCode.java index 7a5a9c050..54be7eb1c 100644 --- a/src/main/java/org/stellar/sdk/xdr/ChangeTrustResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ChangeTrustResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -90,7 +90,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -102,7 +102,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ChangeTrustResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimAtom.java b/src/main/java/org/stellar/sdk/xdr/ClaimAtom.java index fbff8b168..20553b9c9 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimAtom.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimAtom.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -163,7 +163,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -175,7 +175,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimAtom fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimAtomType.java b/src/main/java/org/stellar/sdk/xdr/ClaimAtomType.java index 5a3e4a4a2..01d86386d 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimAtomType.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimAtomType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -59,7 +59,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -71,7 +71,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimAtomType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceOp.java b/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceOp.java index d05b01927..b2b98bc0c 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimClaimableBalanceOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResult.java b/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResult.java index ef710d25b..8f77d6911 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -111,7 +111,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -123,7 +123,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimClaimableBalanceResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResultCode.java b/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResultCode.java index 475ec3e8f..186e40cdb 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimClaimableBalanceResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimClaimableBalanceResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimLiquidityAtom.java b/src/main/java/org/stellar/sdk/xdr/ClaimLiquidityAtom.java index 1c45b542b..c39623d30 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimLiquidityAtom.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimLiquidityAtom.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -125,7 +125,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -137,7 +137,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimLiquidityAtom fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtom.java b/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtom.java index 55da15ce9..18703d564 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtom.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtom.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -145,7 +145,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -157,7 +157,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimOfferAtom fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtomV0.java b/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtomV0.java index acf4435b1..c321cb92d 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtomV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimOfferAtomV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -145,7 +145,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -157,7 +157,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimOfferAtomV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimPredicate.java b/src/main/java/org/stellar/sdk/xdr/ClaimPredicate.java index 44ddc6a1f..159fbbfc4 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimPredicate.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimPredicate.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -253,7 +253,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -265,7 +265,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimPredicate fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimPredicateType.java b/src/main/java/org/stellar/sdk/xdr/ClaimPredicateType.java index 232600eaf..93e4bebcf 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimPredicateType.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimPredicateType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -72,7 +72,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -84,7 +84,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimPredicateType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntry.java b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntry.java index 6c5164f45..ff084f9f0 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntry.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -147,7 +147,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -159,7 +159,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -307,7 +307,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -319,7 +319,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntryExtensionV1.java b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntryExtensionV1.java index 6d078f36d..bb7197794 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntryExtensionV1.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceEntryExtensionV1.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -88,7 +88,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -100,7 +100,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceEntryExtensionV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -207,7 +207,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -219,7 +219,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceEntryExtensionV1Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceFlags.java b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceFlags.java index 87e307958..82b971e59 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceFlags.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceFlags.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -54,7 +54,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -66,7 +66,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceFlags fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceID.java b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceID.java index a2adef3fb..4140b8f7d 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceID.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceID.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceIDType.java b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceIDType.java index b4450f579..6af13df6f 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceIDType.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimableBalanceIDType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -52,7 +52,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -64,7 +64,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimableBalanceIDType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Claimant.java b/src/main/java/org/stellar/sdk/xdr/Claimant.java index 0c8d14b3c..b9b7192c1 100644 --- a/src/main/java/org/stellar/sdk/xdr/Claimant.java +++ b/src/main/java/org/stellar/sdk/xdr/Claimant.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -114,7 +114,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -126,7 +126,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Claimant fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -194,7 +194,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -206,7 +206,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimantV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClaimantType.java b/src/main/java/org/stellar/sdk/xdr/ClaimantType.java index c27943bf3..94bb662e9 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClaimantType.java +++ b/src/main/java/org/stellar/sdk/xdr/ClaimantType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -51,7 +51,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -63,7 +63,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClaimantType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceOp.java b/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceOp.java index e99f07e85..b622450e6 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClawbackClaimableBalanceOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResult.java b/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResult.java index 5a1a44e71..9104d20a3 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -109,7 +109,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -121,7 +121,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClawbackClaimableBalanceResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResultCode.java b/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResultCode.java index 6e2e61692..3e48ec33d 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ClawbackClaimableBalanceResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClawbackClaimableBalanceResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClawbackOp.java b/src/main/java/org/stellar/sdk/xdr/ClawbackOp.java index 4d40bec5b..d45726f8f 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClawbackOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ClawbackOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -92,7 +92,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -104,7 +104,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClawbackOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClawbackResult.java b/src/main/java/org/stellar/sdk/xdr/ClawbackResult.java index 6cebe6245..90c6c43e3 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClawbackResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ClawbackResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -106,7 +106,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -118,7 +118,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClawbackResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ClawbackResultCode.java b/src/main/java/org/stellar/sdk/xdr/ClawbackResultCode.java index 576f10642..dbb9c969b 100644 --- a/src/main/java/org/stellar/sdk/xdr/ClawbackResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ClawbackResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -71,7 +71,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -83,7 +83,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ClawbackResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractBandwidthV0.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractBandwidthV0.java index 44fb1ffd7..6edc5b5ed 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractBandwidthV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractBandwidthV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -100,7 +100,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -112,7 +112,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingContractBandwidthV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractComputeV0.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractComputeV0.java index 3367bcb41..c3d6eae00 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractComputeV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractComputeV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -121,7 +121,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -133,7 +133,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingContractComputeV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractEventsV0.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractEventsV0.java index e12c1f2c3..4b3e318df 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractEventsV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractEventsV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -83,7 +83,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -95,7 +95,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingContractEventsV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractExecutionLanesV0.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractExecutionLanesV0.java index 5ff955c77..7dd8d5c74 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractExecutionLanesV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractExecutionLanesV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -81,7 +81,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingContractExecutionLanesV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractHistoricalDataV0.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractHistoricalDataV0.java index 553b78164..6c077c0a3 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractHistoricalDataV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractHistoricalDataV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingContractHistoricalDataV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractLedgerCostV0.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractLedgerCostV0.java index 5a284e6ec..0899ff7a7 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractLedgerCostV0.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingContractLedgerCostV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -297,7 +297,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -309,7 +309,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingContractLedgerCostV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java index 5a539ec28..102ad435c 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -483,7 +483,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -495,7 +495,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java index 8b691e033..ec1afab94 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -103,7 +103,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -115,7 +115,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigSettingID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSet.java b/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSet.java index 4017cf0f6..4bbaf08f8 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSet.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSet.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -71,7 +71,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -83,7 +83,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigUpgradeSet fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSetKey.java b/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSetKey.java index e43f450da..bdf773ebb 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSetKey.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigUpgradeSetKey.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ConfigUpgradeSetKey fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractCodeEntry.java b/src/main/java/org/stellar/sdk/xdr/ContractCodeEntry.java index f4cb52371..a31bb9237 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractCodeEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractCodeEntry.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -97,7 +97,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -109,7 +109,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractCodeEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractCostParamEntry.java b/src/main/java/org/stellar/sdk/xdr/ContractCostParamEntry.java index 7cef7a241..096dd4618 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractCostParamEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractCostParamEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -94,7 +94,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -106,7 +106,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractCostParamEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractCostParams.java b/src/main/java/org/stellar/sdk/xdr/ContractCostParams.java index 203b067db..c7339b61c 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractCostParams.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractCostParams.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -74,7 +74,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -86,7 +86,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractCostParams fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractCostType.java b/src/main/java/org/stellar/sdk/xdr/ContractCostType.java index 8ff3a78c4..69631667b 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractCostType.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractCostType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -190,7 +190,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -202,7 +202,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractCostType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractDataDurability.java b/src/main/java/org/stellar/sdk/xdr/ContractDataDurability.java index 7a7f8032d..a8f5cb67f 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractDataDurability.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractDataDurability.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -55,7 +55,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -67,7 +67,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractDataDurability fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractDataEntry.java b/src/main/java/org/stellar/sdk/xdr/ContractDataEntry.java index 0c1b5b8b8..34cc565a6 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractDataEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractDataEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -120,7 +120,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -132,7 +132,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractDataEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractEvent.java b/src/main/java/org/stellar/sdk/xdr/ContractEvent.java index 01e955a92..25c97e214 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractEvent.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractEvent.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -128,7 +128,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -140,7 +140,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractEvent fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -276,7 +276,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -288,7 +288,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractEventBody fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -363,7 +363,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -375,7 +375,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractEventV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractEventType.java b/src/main/java/org/stellar/sdk/xdr/ContractEventType.java index 21d202ea8..0ad4a5ccc 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractEventType.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractEventType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -60,7 +60,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -72,7 +72,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractEventType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java b/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java index 8007fcbd8..4120bd844 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -116,7 +116,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -128,7 +128,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractExecutable fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java b/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java index 76c59da2b..f84376601 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractExecutableType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractIDPreimage.java b/src/main/java/org/stellar/sdk/xdr/ContractIDPreimage.java index ff8dfdff9..693645b88 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractIDPreimage.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractIDPreimage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -141,7 +141,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -153,7 +153,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractIDPreimage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -224,7 +224,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -236,7 +236,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractIDPreimageFromAddress fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractIDPreimageType.java b/src/main/java/org/stellar/sdk/xdr/ContractIDPreimageType.java index a9a113e0e..969f6c6c4 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractIDPreimageType.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractIDPreimageType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ContractIDPreimageType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateAccountOp.java b/src/main/java/org/stellar/sdk/xdr/CreateAccountOp.java index 11d84b9a7..b9a4115b8 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateAccountOp.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateAccountOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateAccountOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateAccountResult.java b/src/main/java/org/stellar/sdk/xdr/CreateAccountResult.java index 2ed001166..2f49e32f0 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateAccountResult.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateAccountResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -107,7 +107,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -119,7 +119,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateAccountResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateAccountResultCode.java b/src/main/java/org/stellar/sdk/xdr/CreateAccountResultCode.java index dde756a97..10963c0f5 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateAccountResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateAccountResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -72,7 +72,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -84,7 +84,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateAccountResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceOp.java b/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceOp.java index 4a428218c..5da8f81f5 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceOp.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceOp.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -102,7 +102,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -114,7 +114,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateClaimableBalanceOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResult.java b/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResult.java index 98ded2563..5241a05a6 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResult.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -131,7 +131,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -143,7 +143,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateClaimableBalanceResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResultCode.java b/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResultCode.java index b19e0e98e..72ec7f369 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateClaimableBalanceResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateClaimableBalanceResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreateContractArgs.java b/src/main/java/org/stellar/sdk/xdr/CreateContractArgs.java index 0d7cce8f4..aa89301e3 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreateContractArgs.java +++ b/src/main/java/org/stellar/sdk/xdr/CreateContractArgs.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreateContractArgs fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CreatePassiveSellOfferOp.java b/src/main/java/org/stellar/sdk/xdr/CreatePassiveSellOfferOp.java index 0d8e0a90b..f03c2bc78 100644 --- a/src/main/java/org/stellar/sdk/xdr/CreatePassiveSellOfferOp.java +++ b/src/main/java/org/stellar/sdk/xdr/CreatePassiveSellOfferOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -107,7 +107,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -119,7 +119,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CreatePassiveSellOfferOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/CryptoKeyType.java b/src/main/java/org/stellar/sdk/xdr/CryptoKeyType.java index 80509f5d7..96b8e3a26 100644 --- a/src/main/java/org/stellar/sdk/xdr/CryptoKeyType.java +++ b/src/main/java/org/stellar/sdk/xdr/CryptoKeyType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -81,7 +81,7 @@ public byte[] toXdrByteArray() throws IOException { } public static CryptoKeyType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Curve25519Public.java b/src/main/java/org/stellar/sdk/xdr/Curve25519Public.java index b94746477..586093509 100644 --- a/src/main/java/org/stellar/sdk/xdr/Curve25519Public.java +++ b/src/main/java/org/stellar/sdk/xdr/Curve25519Public.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Curve25519Public fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Curve25519Secret.java b/src/main/java/org/stellar/sdk/xdr/Curve25519Secret.java index 1b4e2ec51..4b727d78c 100644 --- a/src/main/java/org/stellar/sdk/xdr/Curve25519Secret.java +++ b/src/main/java/org/stellar/sdk/xdr/Curve25519Secret.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Curve25519Secret fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/DataEntry.java b/src/main/java/org/stellar/sdk/xdr/DataEntry.java index 4b279752d..2913193ab 100644 --- a/src/main/java/org/stellar/sdk/xdr/DataEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/DataEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -113,7 +113,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -125,7 +125,7 @@ public byte[] toXdrByteArray() throws IOException { } public static DataEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -242,7 +242,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -254,7 +254,7 @@ public byte[] toXdrByteArray() throws IOException { } public static DataEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/DataValue.java b/src/main/java/org/stellar/sdk/xdr/DataValue.java index 433a40782..4a98b9849 100644 --- a/src/main/java/org/stellar/sdk/xdr/DataValue.java +++ b/src/main/java/org/stellar/sdk/xdr/DataValue.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -81,7 +81,7 @@ public byte[] toXdrByteArray() throws IOException { } public static DataValue fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/DecoratedSignature.java b/src/main/java/org/stellar/sdk/xdr/DecoratedSignature.java index 48d3be132..47367639b 100644 --- a/src/main/java/org/stellar/sdk/xdr/DecoratedSignature.java +++ b/src/main/java/org/stellar/sdk/xdr/DecoratedSignature.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static DecoratedSignature fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/DiagnosticEvent.java b/src/main/java/org/stellar/sdk/xdr/DiagnosticEvent.java index 2479f2428..3044627c5 100644 --- a/src/main/java/org/stellar/sdk/xdr/DiagnosticEvent.java +++ b/src/main/java/org/stellar/sdk/xdr/DiagnosticEvent.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static DiagnosticEvent fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/DontHave.java b/src/main/java/org/stellar/sdk/xdr/DontHave.java index 0174ec9a8..0d59b986a 100644 --- a/src/main/java/org/stellar/sdk/xdr/DontHave.java +++ b/src/main/java/org/stellar/sdk/xdr/DontHave.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static DontHave fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Duration.java b/src/main/java/org/stellar/sdk/xdr/Duration.java index 850afd980..5080126b6 100644 --- a/src/main/java/org/stellar/sdk/xdr/Duration.java +++ b/src/main/java/org/stellar/sdk/xdr/Duration.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Duration fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/EncryptedBody.java b/src/main/java/org/stellar/sdk/xdr/EncryptedBody.java index 195f3bbdb..a9dd79cdd 100644 --- a/src/main/java/org/stellar/sdk/xdr/EncryptedBody.java +++ b/src/main/java/org/stellar/sdk/xdr/EncryptedBody.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -81,7 +81,7 @@ public byte[] toXdrByteArray() throws IOException { } public static EncryptedBody fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResult.java b/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResult.java index 90123a3e7..aca4082f2 100644 --- a/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResult.java +++ b/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -103,7 +103,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -115,7 +115,7 @@ public byte[] toXdrByteArray() throws IOException { } public static EndSponsoringFutureReservesResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResultCode.java b/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResultCode.java index 1d51c8c41..4056a3942 100644 --- a/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/EndSponsoringFutureReservesResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -60,7 +60,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -72,7 +72,7 @@ public byte[] toXdrByteArray() throws IOException { } public static EndSponsoringFutureReservesResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/EnvelopeType.java b/src/main/java/org/stellar/sdk/xdr/EnvelopeType.java index cda5a5a0d..78e035740 100644 --- a/src/main/java/org/stellar/sdk/xdr/EnvelopeType.java +++ b/src/main/java/org/stellar/sdk/xdr/EnvelopeType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static EnvelopeType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Error.java b/src/main/java/org/stellar/sdk/xdr/Error.java index 8cd781329..d1855bcf6 100644 --- a/src/main/java/org/stellar/sdk/xdr/Error.java +++ b/src/main/java/org/stellar/sdk/xdr/Error.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Error fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ErrorCode.java b/src/main/java/org/stellar/sdk/xdr/ErrorCode.java index 87e1cb529..5ae0f23c2 100644 --- a/src/main/java/org/stellar/sdk/xdr/ErrorCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ErrorCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ErrorCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/EvictionIterator.java b/src/main/java/org/stellar/sdk/xdr/EvictionIterator.java index d190d4e65..877da1c8c 100644 --- a/src/main/java/org/stellar/sdk/xdr/EvictionIterator.java +++ b/src/main/java/org/stellar/sdk/xdr/EvictionIterator.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -91,7 +91,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -103,7 +103,7 @@ public byte[] toXdrByteArray() throws IOException { } public static EvictionIterator fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java b/src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java index f5d0a6555..4a34cd939 100644 --- a/src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ExpirationEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ExtensionPoint.java b/src/main/java/org/stellar/sdk/xdr/ExtensionPoint.java index fa72e4391..36533c929 100644 --- a/src/main/java/org/stellar/sdk/xdr/ExtensionPoint.java +++ b/src/main/java/org/stellar/sdk/xdr/ExtensionPoint.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -91,7 +91,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -103,7 +103,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ExtensionPoint fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/FeeBumpTransaction.java b/src/main/java/org/stellar/sdk/xdr/FeeBumpTransaction.java index 0463a6137..cb22bbb8c 100644 --- a/src/main/java/org/stellar/sdk/xdr/FeeBumpTransaction.java +++ b/src/main/java/org/stellar/sdk/xdr/FeeBumpTransaction.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -116,7 +116,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -128,7 +128,7 @@ public byte[] toXdrByteArray() throws IOException { } public static FeeBumpTransaction fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -265,7 +265,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -277,7 +277,7 @@ public byte[] toXdrByteArray() throws IOException { } public static FeeBumpTransactionInnerTx fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -360,7 +360,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -372,7 +372,7 @@ public byte[] toXdrByteArray() throws IOException { } public static FeeBumpTransactionExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/FeeBumpTransactionEnvelope.java b/src/main/java/org/stellar/sdk/xdr/FeeBumpTransactionEnvelope.java index 5275168d1..ae13f751b 100644 --- a/src/main/java/org/stellar/sdk/xdr/FeeBumpTransactionEnvelope.java +++ b/src/main/java/org/stellar/sdk/xdr/FeeBumpTransactionEnvelope.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -89,7 +89,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -101,7 +101,7 @@ public byte[] toXdrByteArray() throws IOException { } public static FeeBumpTransactionEnvelope fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/FloodAdvert.java b/src/main/java/org/stellar/sdk/xdr/FloodAdvert.java index 6263eeb7d..0cdbad146 100644 --- a/src/main/java/org/stellar/sdk/xdr/FloodAdvert.java +++ b/src/main/java/org/stellar/sdk/xdr/FloodAdvert.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static FloodAdvert fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/FloodDemand.java b/src/main/java/org/stellar/sdk/xdr/FloodDemand.java index 2c0ca87c2..7d9d8800f 100644 --- a/src/main/java/org/stellar/sdk/xdr/FloodDemand.java +++ b/src/main/java/org/stellar/sdk/xdr/FloodDemand.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static FloodDemand fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/GeneralizedTransactionSet.java b/src/main/java/org/stellar/sdk/xdr/GeneralizedTransactionSet.java index 5d677dc43..53f38a877 100644 --- a/src/main/java/org/stellar/sdk/xdr/GeneralizedTransactionSet.java +++ b/src/main/java/org/stellar/sdk/xdr/GeneralizedTransactionSet.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -112,7 +112,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -124,7 +124,7 @@ public byte[] toXdrByteArray() throws IOException { } public static GeneralizedTransactionSet fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Hash.java b/src/main/java/org/stellar/sdk/xdr/Hash.java index f72221f1d..9731c3aa6 100644 --- a/src/main/java/org/stellar/sdk/xdr/Hash.java +++ b/src/main/java/org/stellar/sdk/xdr/Hash.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Hash fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/HashIDPreimage.java b/src/main/java/org/stellar/sdk/xdr/HashIDPreimage.java index 5216f1a5c..5b723abae 100644 --- a/src/main/java/org/stellar/sdk/xdr/HashIDPreimage.java +++ b/src/main/java/org/stellar/sdk/xdr/HashIDPreimage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -214,7 +214,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -226,7 +226,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HashIDPreimage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -308,7 +308,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -320,7 +320,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HashIDPreimageOperationID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -459,7 +459,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -471,7 +471,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HashIDPreimageRevokeID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -584,7 +584,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -596,7 +596,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HashIDPreimageContractID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -720,7 +720,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -732,7 +732,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HashIDPreimageSorobanAuthorization fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Hello.java b/src/main/java/org/stellar/sdk/xdr/Hello.java index e64d1faf8..67ca96d82 100644 --- a/src/main/java/org/stellar/sdk/xdr/Hello.java +++ b/src/main/java/org/stellar/sdk/xdr/Hello.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -184,7 +184,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -196,7 +196,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Hello fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/HmacSha256Key.java b/src/main/java/org/stellar/sdk/xdr/HmacSha256Key.java index 6adce32ef..538b74cdc 100644 --- a/src/main/java/org/stellar/sdk/xdr/HmacSha256Key.java +++ b/src/main/java/org/stellar/sdk/xdr/HmacSha256Key.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HmacSha256Key fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/HmacSha256Mac.java b/src/main/java/org/stellar/sdk/xdr/HmacSha256Mac.java index 1a741c7b4..92785110b 100644 --- a/src/main/java/org/stellar/sdk/xdr/HmacSha256Mac.java +++ b/src/main/java/org/stellar/sdk/xdr/HmacSha256Mac.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HmacSha256Mac fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/HostFunction.java b/src/main/java/org/stellar/sdk/xdr/HostFunction.java index d0d2245e8..d2d022268 100644 --- a/src/main/java/org/stellar/sdk/xdr/HostFunction.java +++ b/src/main/java/org/stellar/sdk/xdr/HostFunction.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -169,7 +169,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -181,7 +181,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HostFunction fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/HostFunctionType.java b/src/main/java/org/stellar/sdk/xdr/HostFunctionType.java index 18f84e1d4..d682823f4 100644 --- a/src/main/java/org/stellar/sdk/xdr/HostFunctionType.java +++ b/src/main/java/org/stellar/sdk/xdr/HostFunctionType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -59,7 +59,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -71,7 +71,7 @@ public byte[] toXdrByteArray() throws IOException { } public static HostFunctionType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/IPAddrType.java b/src/main/java/org/stellar/sdk/xdr/IPAddrType.java index 0d24dde81..390d4c084 100644 --- a/src/main/java/org/stellar/sdk/xdr/IPAddrType.java +++ b/src/main/java/org/stellar/sdk/xdr/IPAddrType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -55,7 +55,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -67,7 +67,7 @@ public byte[] toXdrByteArray() throws IOException { } public static IPAddrType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InflationPayout.java b/src/main/java/org/stellar/sdk/xdr/InflationPayout.java index 37d782cfe..294780f99 100644 --- a/src/main/java/org/stellar/sdk/xdr/InflationPayout.java +++ b/src/main/java/org/stellar/sdk/xdr/InflationPayout.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InflationPayout fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InflationResult.java b/src/main/java/org/stellar/sdk/xdr/InflationResult.java index 394d2d0c1..aefb339ba 100644 --- a/src/main/java/org/stellar/sdk/xdr/InflationResult.java +++ b/src/main/java/org/stellar/sdk/xdr/InflationResult.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -125,7 +125,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -137,7 +137,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InflationResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InflationResultCode.java b/src/main/java/org/stellar/sdk/xdr/InflationResultCode.java index d483d06c7..ad61b7aa3 100644 --- a/src/main/java/org/stellar/sdk/xdr/InflationResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/InflationResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -58,7 +58,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -70,7 +70,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InflationResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InnerTransactionResult.java b/src/main/java/org/stellar/sdk/xdr/InnerTransactionResult.java index b0b8af05d..0b2c7e478 100644 --- a/src/main/java/org/stellar/sdk/xdr/InnerTransactionResult.java +++ b/src/main/java/org/stellar/sdk/xdr/InnerTransactionResult.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -127,7 +127,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -139,7 +139,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InnerTransactionResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -314,7 +314,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -326,7 +326,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InnerTransactionResultResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -409,7 +409,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -421,7 +421,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InnerTransactionResultExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InnerTransactionResultPair.java b/src/main/java/org/stellar/sdk/xdr/InnerTransactionResultPair.java index 3a141b39b..3c5b02ef4 100644 --- a/src/main/java/org/stellar/sdk/xdr/InnerTransactionResultPair.java +++ b/src/main/java/org/stellar/sdk/xdr/InnerTransactionResultPair.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InnerTransactionResultPair fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Int128Parts.java b/src/main/java/org/stellar/sdk/xdr/Int128Parts.java index 1c09044cc..2c618328b 100644 --- a/src/main/java/org/stellar/sdk/xdr/Int128Parts.java +++ b/src/main/java/org/stellar/sdk/xdr/Int128Parts.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Int128Parts fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Int256Parts.java b/src/main/java/org/stellar/sdk/xdr/Int256Parts.java index 977f64e9a..a9c1aed2f 100644 --- a/src/main/java/org/stellar/sdk/xdr/Int256Parts.java +++ b/src/main/java/org/stellar/sdk/xdr/Int256Parts.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -105,7 +105,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -117,7 +117,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Int256Parts fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Int32.java b/src/main/java/org/stellar/sdk/xdr/Int32.java index ca0d4b012..9717122a7 100644 --- a/src/main/java/org/stellar/sdk/xdr/Int32.java +++ b/src/main/java/org/stellar/sdk/xdr/Int32.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Int32 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Int64.java b/src/main/java/org/stellar/sdk/xdr/Int64.java index d29362e3d..d90aceda1 100644 --- a/src/main/java/org/stellar/sdk/xdr/Int64.java +++ b/src/main/java/org/stellar/sdk/xdr/Int64.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Int64 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeContractArgs.java b/src/main/java/org/stellar/sdk/xdr/InvokeContractArgs.java index b37ad8c51..0e2784684 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeContractArgs.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeContractArgs.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -100,7 +100,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -112,7 +112,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InvokeContractArgs fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionOp.java b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionOp.java index 6a1348f09..0cb6d6ed5 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionOp.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionOp.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -90,7 +90,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -102,7 +102,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InvokeHostFunctionOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java index f8c7850da..b9d3df511 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -129,7 +129,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -141,7 +141,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InvokeHostFunctionResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java index 9bd43f4ba..0ad3336ea 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -75,7 +75,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -87,7 +87,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InvokeHostFunctionResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionSuccessPreImage.java b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionSuccessPreImage.java index 21a5656e3..d2c69bd6a 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionSuccessPreImage.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionSuccessPreImage.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -91,7 +91,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -103,7 +103,7 @@ public byte[] toXdrByteArray() throws IOException { } public static InvokeHostFunctionSuccessPreImage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerBounds.java b/src/main/java/org/stellar/sdk/xdr/LedgerBounds.java index 179a7598d..dd971a737 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerBounds.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerBounds.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerBounds fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java index c39ab4434..99a0a160b 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -163,7 +163,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -175,7 +175,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerCloseMeta fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV0.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV0.java index 64281560b..1e8d60f19 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV0.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -159,7 +159,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -171,7 +171,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerCloseMetaV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java index c21f78354..484a78de2 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -159,7 +159,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -171,7 +171,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerCloseMetaV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java index 053560cec..ddb7556f8 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -250,7 +250,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -262,7 +262,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerCloseMetaV2 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseValueSignature.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseValueSignature.java index 470635bd5..d080b2d2e 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseValueSignature.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseValueSignature.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerCloseValueSignature fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java index 248a39498..ebbd53269 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -125,7 +125,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -137,7 +137,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -494,7 +494,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -506,7 +506,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryData fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -611,7 +611,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -623,7 +623,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntryChange.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntryChange.java index 1fa6cfeac..7bd4c0040 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntryChange.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntryChange.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -189,7 +189,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -201,7 +201,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryChange fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntryChangeType.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntryChangeType.java index 88fa5dabc..4a1de0342 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntryChangeType.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntryChangeType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryChangeType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntryChanges.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntryChanges.java index 3c051d783..b70f409e1 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntryChanges.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntryChanges.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryChanges fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntryExtensionV1.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntryExtensionV1.java index e7a6510c6..45a1b03fe 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntryExtensionV1.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntryExtensionV1.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -85,7 +85,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -97,7 +97,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryExtensionV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -201,7 +201,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -213,7 +213,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryExtensionV1Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java index 40774d025..be137b929 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerEntryType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerFootprint.java b/src/main/java/org/stellar/sdk/xdr/LedgerFootprint.java index 827e3beab..f1593071c 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerFootprint.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerFootprint.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -95,7 +95,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -107,7 +107,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerFootprint fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerHeader.java b/src/main/java/org/stellar/sdk/xdr/LedgerHeader.java index bcd463efe..3f83cb367 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerHeader.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerHeader.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -304,7 +304,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -316,7 +316,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeader fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -533,7 +533,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -545,7 +545,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeaderExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerHeaderExtensionV1.java b/src/main/java/org/stellar/sdk/xdr/LedgerHeaderExtensionV1.java index d81323626..9c7263c87 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerHeaderExtensionV1.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerHeaderExtensionV1.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -84,7 +84,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -96,7 +96,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeaderExtensionV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -201,7 +201,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -213,7 +213,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeaderExtensionV1Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerHeaderFlags.java b/src/main/java/org/stellar/sdk/xdr/LedgerHeaderFlags.java index 73f179e81..d041e5ad3 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerHeaderFlags.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerHeaderFlags.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -60,7 +60,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -72,7 +72,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeaderFlags fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerHeaderHistoryEntry.java b/src/main/java/org/stellar/sdk/xdr/LedgerHeaderHistoryEntry.java index b8c91b502..2b6c25fa1 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerHeaderHistoryEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerHeaderHistoryEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -100,7 +100,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -112,7 +112,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeaderHistoryEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -224,7 +224,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -236,7 +236,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerHeaderHistoryEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerKey.java b/src/main/java/org/stellar/sdk/xdr/LedgerKey.java index 9637f7848..bcc4d7458 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerKey.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerKey.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -397,7 +397,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -409,7 +409,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKey fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -464,7 +464,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -476,7 +476,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyAccount fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -561,7 +561,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -573,7 +573,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyTrustLine fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -664,7 +664,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -676,7 +676,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyOffer fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -767,7 +767,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -779,7 +779,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyData fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -858,7 +858,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -870,7 +870,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyClaimableBalance fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -942,7 +942,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -954,7 +954,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyLiquidityPool fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -1052,7 +1052,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -1064,7 +1064,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyContractData fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -1150,7 +1150,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -1162,7 +1162,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyContractCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -1234,7 +1234,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -1246,7 +1246,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyConfigSetting fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -1318,7 +1318,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -1330,7 +1330,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerKeyExpiration fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerSCPMessages.java b/src/main/java/org/stellar/sdk/xdr/LedgerSCPMessages.java index 734e792a5..0fbe47de5 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerSCPMessages.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerSCPMessages.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerSCPMessages fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerUpgrade.java b/src/main/java/org/stellar/sdk/xdr/LedgerUpgrade.java index e91d0416b..e0c4b9388 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerUpgrade.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerUpgrade.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -278,7 +278,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -290,7 +290,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerUpgrade fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerUpgradeType.java b/src/main/java/org/stellar/sdk/xdr/LedgerUpgradeType.java index d44e68d1c..5b18a05f1 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerUpgradeType.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerUpgradeType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LedgerUpgradeType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Liabilities.java b/src/main/java/org/stellar/sdk/xdr/Liabilities.java index 851b06ef6..73453a3f3 100644 --- a/src/main/java/org/stellar/sdk/xdr/Liabilities.java +++ b/src/main/java/org/stellar/sdk/xdr/Liabilities.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Liabilities fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolConstantProductParameters.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolConstantProductParameters.java index c10d88b23..ed6a01ef1 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolConstantProductParameters.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolConstantProductParameters.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -96,7 +96,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -109,7 +109,7 @@ public byte[] toXdrByteArray() throws IOException { public static LiquidityPoolConstantProductParameters fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositOp.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositOp.java index c57457134..a8fcd4ec6 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositOp.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -122,7 +122,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -134,7 +134,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolDepositOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResult.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResult.java index d6485dd21..031772d29 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResult.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -116,7 +116,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -128,7 +128,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolDepositResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResultCode.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResultCode.java index e409f7c29..4dd187201 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolDepositResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -88,7 +88,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -100,7 +100,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolDepositResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolEntry.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolEntry.java index 86d199b71..11ff1d538 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -231,7 +231,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -243,7 +243,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolEntryBody fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -361,7 +361,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -373,7 +373,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolEntryConstantProduct fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolParameters.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolParameters.java index e36a29f9f..5cb765f9e 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolParameters.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolParameters.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -114,7 +114,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -126,7 +126,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolParameters fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolType.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolType.java index f3b194758..d31d89075 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolType.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -52,7 +52,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -64,7 +64,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawOp.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawOp.java index e5e5412a9..fd7886730 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawOp.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -107,7 +107,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -119,7 +119,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolWithdrawOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResult.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResult.java index bbe4b663a..3f5a385b8 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResult.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -111,7 +111,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -123,7 +123,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolWithdrawResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResultCode.java b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResultCode.java index 8af5e77fc..bc97c02be 100644 --- a/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/LiquidityPoolWithdrawResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static LiquidityPoolWithdrawResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java index 943b24f65..902fc22b0 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -123,7 +123,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -135,7 +135,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageBuyOfferOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java index c04c7eae2..2d9817280 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -150,7 +150,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -162,7 +162,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageBuyOfferResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResultCode.java b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResultCode.java index b6c171803..ae695cdb0 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -107,7 +107,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -119,7 +119,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageBuyOfferResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageDataOp.java b/src/main/java/org/stellar/sdk/xdr/ManageDataOp.java index 77ab7e67c..3d4fc3b7b 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageDataOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageDataOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -86,7 +86,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -98,7 +98,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageDataOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageDataResult.java b/src/main/java/org/stellar/sdk/xdr/ManageDataResult.java index 910c8b379..897849ade 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageDataResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageDataResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -106,7 +106,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -118,7 +118,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageDataResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageDataResultCode.java b/src/main/java/org/stellar/sdk/xdr/ManageDataResultCode.java index 8437b3885..ef1d634e2 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageDataResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageDataResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -72,7 +72,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -84,7 +84,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageDataResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageOfferEffect.java b/src/main/java/org/stellar/sdk/xdr/ManageOfferEffect.java index 21e28766b..e66d714fd 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageOfferEffect.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageOfferEffect.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -60,7 +60,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -72,7 +72,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageOfferEffect fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageOfferSuccessResult.java b/src/main/java/org/stellar/sdk/xdr/ManageOfferSuccessResult.java index 0a916fc24..c17fa3df0 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageOfferSuccessResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageOfferSuccessResult.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -98,7 +98,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -110,7 +110,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageOfferSuccessResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -242,7 +242,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -254,7 +254,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageOfferSuccessResultOffer fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java index f6808c0dd..14d9d8a6f 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -122,7 +122,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -134,7 +134,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageSellOfferOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResult.java b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResult.java index 69475ace2..b161316b1 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -150,7 +150,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -162,7 +162,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageSellOfferResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResultCode.java b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResultCode.java index bfedd49fc..321b30594 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ManageSellOfferResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Memo.java b/src/main/java/org/stellar/sdk/xdr/Memo.java index f7a402d41..275af9160 100644 --- a/src/main/java/org/stellar/sdk/xdr/Memo.java +++ b/src/main/java/org/stellar/sdk/xdr/Memo.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -194,7 +194,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -206,7 +206,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Memo fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/MemoType.java b/src/main/java/org/stellar/sdk/xdr/MemoType.java index f4f32e448..a682512a0 100644 --- a/src/main/java/org/stellar/sdk/xdr/MemoType.java +++ b/src/main/java/org/stellar/sdk/xdr/MemoType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static MemoType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/MessageType.java b/src/main/java/org/stellar/sdk/xdr/MessageType.java index d93ea3c47..0a08ece50 100644 --- a/src/main/java/org/stellar/sdk/xdr/MessageType.java +++ b/src/main/java/org/stellar/sdk/xdr/MessageType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -137,7 +137,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -149,7 +149,7 @@ public byte[] toXdrByteArray() throws IOException { } public static MessageType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/MuxedAccount.java b/src/main/java/org/stellar/sdk/xdr/MuxedAccount.java index d3f2351ea..3a082a148 100644 --- a/src/main/java/org/stellar/sdk/xdr/MuxedAccount.java +++ b/src/main/java/org/stellar/sdk/xdr/MuxedAccount.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -141,7 +141,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -153,7 +153,7 @@ public byte[] toXdrByteArray() throws IOException { } public static MuxedAccount fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -221,7 +221,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -233,7 +233,7 @@ public byte[] toXdrByteArray() throws IOException { } public static MuxedAccountMed25519 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/NodeID.java b/src/main/java/org/stellar/sdk/xdr/NodeID.java index 37c9de666..6be2e1077 100644 --- a/src/main/java/org/stellar/sdk/xdr/NodeID.java +++ b/src/main/java/org/stellar/sdk/xdr/NodeID.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static NodeID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/OfferEntry.java b/src/main/java/org/stellar/sdk/xdr/OfferEntry.java index 578ab2d84..40e95643e 100644 --- a/src/main/java/org/stellar/sdk/xdr/OfferEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/OfferEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -183,7 +183,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -195,7 +195,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OfferEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -340,7 +340,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -352,7 +352,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OfferEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/OfferEntryFlags.java b/src/main/java/org/stellar/sdk/xdr/OfferEntryFlags.java index 07c112686..8fef54b5e 100644 --- a/src/main/java/org/stellar/sdk/xdr/OfferEntryFlags.java +++ b/src/main/java/org/stellar/sdk/xdr/OfferEntryFlags.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -53,7 +53,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -65,7 +65,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OfferEntryFlags fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Operation.java b/src/main/java/org/stellar/sdk/xdr/Operation.java index ba5d805f8..c8fe9d9db 100644 --- a/src/main/java/org/stellar/sdk/xdr/Operation.java +++ b/src/main/java/org/stellar/sdk/xdr/Operation.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -147,7 +147,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -159,7 +159,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Operation fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -903,7 +903,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -915,7 +915,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OperationBody fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/OperationMeta.java b/src/main/java/org/stellar/sdk/xdr/OperationMeta.java index e5181afe0..21201e9a1 100644 --- a/src/main/java/org/stellar/sdk/xdr/OperationMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/OperationMeta.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OperationMeta fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/OperationResult.java b/src/main/java/org/stellar/sdk/xdr/OperationResult.java index e5dd07a70..13d2d51a2 100644 --- a/src/main/java/org/stellar/sdk/xdr/OperationResult.java +++ b/src/main/java/org/stellar/sdk/xdr/OperationResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -188,7 +188,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -200,7 +200,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OperationResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -992,7 +992,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -1004,7 +1004,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OperationResultTr fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/OperationResultCode.java b/src/main/java/org/stellar/sdk/xdr/OperationResultCode.java index b167762de..592d57a30 100644 --- a/src/main/java/org/stellar/sdk/xdr/OperationResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/OperationResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OperationResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/OperationType.java b/src/main/java/org/stellar/sdk/xdr/OperationType.java index 1ffec8c42..d2c51923e 100644 --- a/src/main/java/org/stellar/sdk/xdr/OperationType.java +++ b/src/main/java/org/stellar/sdk/xdr/OperationType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -155,7 +155,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -167,7 +167,7 @@ public byte[] toXdrByteArray() throws IOException { } public static OperationType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveOp.java b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveOp.java index b6a5b5534..a5823f01b 100644 --- a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveOp.java +++ b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveOp.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -154,7 +154,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -166,7 +166,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictReceiveOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResult.java b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResult.java index 98725de63..bd10be807 100644 --- a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResult.java +++ b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResult.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -189,7 +189,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -201,7 +201,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictReceiveResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -280,7 +280,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -293,7 +293,7 @@ public byte[] toXdrByteArray() throws IOException { public static PathPaymentStrictReceiveResultSuccess fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResultCode.java b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResultCode.java index a3690e156..ca28764f0 100644 --- a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictReceiveResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -113,7 +113,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -125,7 +125,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictReceiveResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendOp.java b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendOp.java index f1dab1086..826a90f67 100644 --- a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendOp.java +++ b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendOp.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -154,7 +154,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -166,7 +166,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictSendOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResult.java b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResult.java index 3346740cc..903e347f4 100644 --- a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResult.java +++ b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResult.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -185,7 +185,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -197,7 +197,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictSendResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -276,7 +276,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -288,7 +288,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictSendResultSuccess fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResultCode.java b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResultCode.java index e4624b50b..ae7ef0501 100644 --- a/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/PathPaymentStrictSendResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -112,7 +112,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -124,7 +124,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PathPaymentStrictSendResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PaymentOp.java b/src/main/java/org/stellar/sdk/xdr/PaymentOp.java index 28fe5418a..24efb12ba 100644 --- a/src/main/java/org/stellar/sdk/xdr/PaymentOp.java +++ b/src/main/java/org/stellar/sdk/xdr/PaymentOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -92,7 +92,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -104,7 +104,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PaymentOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PaymentResult.java b/src/main/java/org/stellar/sdk/xdr/PaymentResult.java index 35a798897..064182dec 100644 --- a/src/main/java/org/stellar/sdk/xdr/PaymentResult.java +++ b/src/main/java/org/stellar/sdk/xdr/PaymentResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -121,7 +121,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -133,7 +133,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PaymentResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PaymentResultCode.java b/src/main/java/org/stellar/sdk/xdr/PaymentResultCode.java index 5bd68c860..ab0f9ca3a 100644 --- a/src/main/java/org/stellar/sdk/xdr/PaymentResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/PaymentResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -91,7 +91,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -103,7 +103,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PaymentResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PeerAddress.java b/src/main/java/org/stellar/sdk/xdr/PeerAddress.java index 97f2421b4..59b8cc66d 100644 --- a/src/main/java/org/stellar/sdk/xdr/PeerAddress.java +++ b/src/main/java/org/stellar/sdk/xdr/PeerAddress.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -100,7 +100,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -112,7 +112,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PeerAddress fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -272,7 +272,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -284,7 +284,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PeerAddressIp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PeerStatList.java b/src/main/java/org/stellar/sdk/xdr/PeerStatList.java index 4065a0d27..797885c8f 100644 --- a/src/main/java/org/stellar/sdk/xdr/PeerStatList.java +++ b/src/main/java/org/stellar/sdk/xdr/PeerStatList.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PeerStatList fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PeerStats.java b/src/main/java/org/stellar/sdk/xdr/PeerStats.java index ac31be23b..5b2402d00 100644 --- a/src/main/java/org/stellar/sdk/xdr/PeerStats.java +++ b/src/main/java/org/stellar/sdk/xdr/PeerStats.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -277,7 +277,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -289,7 +289,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PeerStats fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PersistedSCPState.java b/src/main/java/org/stellar/sdk/xdr/PersistedSCPState.java index 5094b3fd0..d8077958f 100644 --- a/src/main/java/org/stellar/sdk/xdr/PersistedSCPState.java +++ b/src/main/java/org/stellar/sdk/xdr/PersistedSCPState.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -137,7 +137,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -149,7 +149,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PersistedSCPState fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV0.java b/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV0.java index b2021a440..4789d44f2 100644 --- a/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV0.java +++ b/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -121,7 +121,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -133,7 +133,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PersistedSCPStateV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV1.java b/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV1.java index ca660fa19..e12b0443b 100644 --- a/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV1.java +++ b/src/main/java/org/stellar/sdk/xdr/PersistedSCPStateV1.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -97,7 +97,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -109,7 +109,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PersistedSCPStateV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PoolID.java b/src/main/java/org/stellar/sdk/xdr/PoolID.java index dcf3f8b9c..835801899 100644 --- a/src/main/java/org/stellar/sdk/xdr/PoolID.java +++ b/src/main/java/org/stellar/sdk/xdr/PoolID.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PoolID fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PreconditionType.java b/src/main/java/org/stellar/sdk/xdr/PreconditionType.java index 0c0baa105..e489d51ad 100644 --- a/src/main/java/org/stellar/sdk/xdr/PreconditionType.java +++ b/src/main/java/org/stellar/sdk/xdr/PreconditionType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -59,7 +59,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -71,7 +71,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PreconditionType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Preconditions.java b/src/main/java/org/stellar/sdk/xdr/Preconditions.java index f50752ae5..02417d864 100644 --- a/src/main/java/org/stellar/sdk/xdr/Preconditions.java +++ b/src/main/java/org/stellar/sdk/xdr/Preconditions.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -143,7 +143,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -155,7 +155,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Preconditions fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PreconditionsV2.java b/src/main/java/org/stellar/sdk/xdr/PreconditionsV2.java index 80f001c7a..7f25965a7 100644 --- a/src/main/java/org/stellar/sdk/xdr/PreconditionsV2.java +++ b/src/main/java/org/stellar/sdk/xdr/PreconditionsV2.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -196,7 +196,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -208,7 +208,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PreconditionsV2 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Price.java b/src/main/java/org/stellar/sdk/xdr/Price.java index e3f0da8fb..6c10c7953 100644 --- a/src/main/java/org/stellar/sdk/xdr/Price.java +++ b/src/main/java/org/stellar/sdk/xdr/Price.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Price fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PublicKey.java b/src/main/java/org/stellar/sdk/xdr/PublicKey.java index 1447caac4..7ca5f8bda 100644 --- a/src/main/java/org/stellar/sdk/xdr/PublicKey.java +++ b/src/main/java/org/stellar/sdk/xdr/PublicKey.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PublicKey fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/PublicKeyType.java b/src/main/java/org/stellar/sdk/xdr/PublicKeyType.java index 5bfd65570..ee9b925c5 100644 --- a/src/main/java/org/stellar/sdk/xdr/PublicKeyType.java +++ b/src/main/java/org/stellar/sdk/xdr/PublicKeyType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -51,7 +51,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -63,7 +63,7 @@ public byte[] toXdrByteArray() throws IOException { } public static PublicKeyType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RestoreFootprintOp.java b/src/main/java/org/stellar/sdk/xdr/RestoreFootprintOp.java index ece865ed7..7d644b2f4 100644 --- a/src/main/java/org/stellar/sdk/xdr/RestoreFootprintOp.java +++ b/src/main/java/org/stellar/sdk/xdr/RestoreFootprintOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RestoreFootprintOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResult.java b/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResult.java index a01215459..69f8f3c67 100644 --- a/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResult.java +++ b/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -104,7 +104,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -116,7 +116,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RestoreFootprintResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResultCode.java b/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResultCode.java index e1d0fd3e7..cd85043f0 100644 --- a/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/RestoreFootprintResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RestoreFootprintResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipOp.java b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipOp.java index c10a0ba19..643a17cc1 100644 --- a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipOp.java +++ b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -142,7 +142,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -154,7 +154,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RevokeSponsorshipOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -223,7 +223,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -235,7 +235,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RevokeSponsorshipOpSigner fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResult.java b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResult.java index b5a027ea4..7204055f6 100644 --- a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResult.java +++ b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RevokeSponsorshipResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResultCode.java b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResultCode.java index edcf6ee99..9d17e1f55 100644 --- a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -75,7 +75,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -87,7 +87,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RevokeSponsorshipResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipType.java b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipType.java index a24bed2e7..7e652e3e2 100644 --- a/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipType.java +++ b/src/main/java/org/stellar/sdk/xdr/RevokeSponsorshipType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static RevokeSponsorshipType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCAddress.java b/src/main/java/org/stellar/sdk/xdr/SCAddress.java index c238538d2..08915541e 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCAddress.java +++ b/src/main/java/org/stellar/sdk/xdr/SCAddress.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -137,7 +137,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -149,7 +149,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCAddress fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCAddressType.java b/src/main/java/org/stellar/sdk/xdr/SCAddressType.java index 05dabef98..6fad84384 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCAddressType.java +++ b/src/main/java/org/stellar/sdk/xdr/SCAddressType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -55,7 +55,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -67,7 +67,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCAddressType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCBytes.java b/src/main/java/org/stellar/sdk/xdr/SCBytes.java index 4fdd71f07..0d3ee7b43 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCBytes.java +++ b/src/main/java/org/stellar/sdk/xdr/SCBytes.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCBytes fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCContractInstance.java b/src/main/java/org/stellar/sdk/xdr/SCContractInstance.java index 8a6bf8816..963506b44 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCContractInstance.java +++ b/src/main/java/org/stellar/sdk/xdr/SCContractInstance.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -85,7 +85,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -97,7 +97,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCContractInstance fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCEnvMetaEntry.java b/src/main/java/org/stellar/sdk/xdr/SCEnvMetaEntry.java index add97d7f0..50269fb4a 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCEnvMetaEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/SCEnvMetaEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -111,7 +111,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -123,7 +123,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCEnvMetaEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCEnvMetaKind.java b/src/main/java/org/stellar/sdk/xdr/SCEnvMetaKind.java index 20d25b485..705b32481 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCEnvMetaKind.java +++ b/src/main/java/org/stellar/sdk/xdr/SCEnvMetaKind.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -51,7 +51,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -63,7 +63,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCEnvMetaKind fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCError.java b/src/main/java/org/stellar/sdk/xdr/SCError.java index 398489cb8..88c902409 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCError.java +++ b/src/main/java/org/stellar/sdk/xdr/SCError.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -160,7 +160,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -172,7 +172,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCError fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCErrorCode.java b/src/main/java/org/stellar/sdk/xdr/SCErrorCode.java index d1918e6b5..19bf0ab62 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCErrorCode.java +++ b/src/main/java/org/stellar/sdk/xdr/SCErrorCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCErrorCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCErrorType.java b/src/main/java/org/stellar/sdk/xdr/SCErrorType.java index b39e8f15b..055b5f2cb 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCErrorType.java +++ b/src/main/java/org/stellar/sdk/xdr/SCErrorType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCErrorType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCMap.java b/src/main/java/org/stellar/sdk/xdr/SCMap.java index 40c395a5e..d6d3d3301 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCMap.java +++ b/src/main/java/org/stellar/sdk/xdr/SCMap.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -72,7 +72,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -84,7 +84,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCMap fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCMapEntry.java b/src/main/java/org/stellar/sdk/xdr/SCMapEntry.java index 65c5de935..898427b7d 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCMapEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/SCMapEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCMapEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCMetaEntry.java b/src/main/java/org/stellar/sdk/xdr/SCMetaEntry.java index bcf2ddcfe..d214ed027 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCMetaEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/SCMetaEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCMetaEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCMetaKind.java b/src/main/java/org/stellar/sdk/xdr/SCMetaKind.java index b4712e4c3..aa40a0212 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCMetaKind.java +++ b/src/main/java/org/stellar/sdk/xdr/SCMetaKind.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -51,7 +51,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -63,7 +63,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCMetaKind fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCMetaV0.java b/src/main/java/org/stellar/sdk/xdr/SCMetaV0.java index 3629a2ec0..7d311191f 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCMetaV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCMetaV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCMetaV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCNonceKey.java b/src/main/java/org/stellar/sdk/xdr/SCNonceKey.java index 494b0c357..4f78e9d43 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCNonceKey.java +++ b/src/main/java/org/stellar/sdk/xdr/SCNonceKey.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -63,7 +63,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -75,7 +75,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCNonceKey fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPBallot.java b/src/main/java/org/stellar/sdk/xdr/SCPBallot.java index 905329573..569e24d7d 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPBallot.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPBallot.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -77,7 +77,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -89,7 +89,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPBallot fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPEnvelope.java b/src/main/java/org/stellar/sdk/xdr/SCPEnvelope.java index 90edd5797..b6ca4b6a2 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPEnvelope.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPEnvelope.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPEnvelope fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntry.java b/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntry.java index c59786ec9..82584d495 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPHistoryEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntryV0.java b/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntryV0.java index f260ac8ba..63e400e69 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntryV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPHistoryEntryV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPHistoryEntryV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPNomination.java b/src/main/java/org/stellar/sdk/xdr/SCPNomination.java index a09a7654a..ef7147c0d 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPNomination.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPNomination.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPNomination fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPQuorumSet.java b/src/main/java/org/stellar/sdk/xdr/SCPQuorumSet.java index 3868ce6e2..533fdd10a 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPQuorumSet.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPQuorumSet.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPQuorumSet fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPStatement.java b/src/main/java/org/stellar/sdk/xdr/SCPStatement.java index 4829a04f1..2875ccc84 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPStatement.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPStatement.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -124,7 +124,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -136,7 +136,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPStatement fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -339,7 +339,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -351,7 +351,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPStatementPledges fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -489,7 +489,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -501,7 +501,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPStatementPrepare fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -660,7 +660,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -672,7 +672,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPStatementConfirm fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -798,7 +798,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -810,7 +810,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPStatementExternalize fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCPStatementType.java b/src/main/java/org/stellar/sdk/xdr/SCPStatementType.java index 4afeed5d1..f910ecf8b 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCPStatementType.java +++ b/src/main/java/org/stellar/sdk/xdr/SCPStatementType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -63,7 +63,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -75,7 +75,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCPStatementType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecEntry.java b/src/main/java/org/stellar/sdk/xdr/SCSpecEntry.java index 14cc67e05..3f301433b 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -221,7 +221,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -233,7 +233,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecEntryKind.java b/src/main/java/org/stellar/sdk/xdr/SCSpecEntryKind.java index 939af0447..264c622ad 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecEntryKind.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecEntryKind.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecEntryKind fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionInputV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionInputV0.java index e3b5e378b..0f91ce377 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionInputV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionInputV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecFunctionInputV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionV0.java index 12100314c..e7f7af141 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecFunctionV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -124,7 +124,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -136,7 +136,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecFunctionV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecType.java b/src/main/java/org/stellar/sdk/xdr/SCSpecType.java index d8b2f9936..fac6c9239 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecType.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -153,7 +153,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -165,7 +165,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeBytesN.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeBytesN.java index 55092cd1f..35286092b 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeBytesN.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeBytesN.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeBytesN fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeDef.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeDef.java index f88c62831..044408aee 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeDef.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeDef.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -325,7 +325,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -337,7 +337,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeDef fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeMap.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeMap.java index 1a2547271..d63684a63 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeMap.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeMap.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeMap fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeOption.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeOption.java index 4bc06f4a4..5bae69b49 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeOption.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeOption.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeOption fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeResult.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeResult.java index a1f6d84ac..82a2f08c4 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeResult.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeTuple.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeTuple.java index ba25be63e..6dac7bc74 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeTuple.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeTuple.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -72,7 +72,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -84,7 +84,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeTuple fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeUDT.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeUDT.java index b22748df9..20005fb1a 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeUDT.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeUDT.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeUDT fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeVec.java b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeVec.java index 10c3a41b6..a21281d31 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecTypeVec.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecTypeVec.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecTypeVec fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumCaseV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumCaseV0.java index c26d9d35a..114492648 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumCaseV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumCaseV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTEnumCaseV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumV0.java index 3397a0b72..4e53c06ca 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -115,7 +115,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -127,7 +127,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTEnumV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumCaseV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumCaseV0.java index 1148aa476..058494b64 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumCaseV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumCaseV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTErrorEnumCaseV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumV0.java index 9e55c65fb..de07725d8 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -116,7 +116,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -128,7 +128,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTErrorEnumV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructFieldV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructFieldV0.java index ccd0d1bae..20a4d34e5 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructFieldV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructFieldV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTStructFieldV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructV0.java index 2fc3a43f3..6060d7cbd 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -115,7 +115,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -127,7 +127,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTStructV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseTupleV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseTupleV0.java index 60c0a065a..b9ae61a45 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseTupleV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseTupleV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -102,7 +102,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -114,7 +114,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTUnionCaseTupleV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0.java index dde5eac73..086a5b0e4 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -138,7 +138,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -150,7 +150,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTUnionCaseV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0Kind.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0Kind.java index a3f701587..765a8c2cf 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0Kind.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseV0Kind.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTUnionCaseV0Kind fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseVoidV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseVoidV0.java index 21f3e12cf..1ab18a278 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseVoidV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionCaseVoidV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTUnionCaseVoidV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionV0.java b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionV0.java index 6ef52f7bd..607408840 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionV0.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -115,7 +115,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -127,7 +127,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSpecUDTUnionV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCString.java b/src/main/java/org/stellar/sdk/xdr/SCString.java index 5e3690af7..f0949019b 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCString.java +++ b/src/main/java/org/stellar/sdk/xdr/SCString.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCString fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCSymbol.java b/src/main/java/org/stellar/sdk/xdr/SCSymbol.java index 63d2867d3..afde380f7 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCSymbol.java +++ b/src/main/java/org/stellar/sdk/xdr/SCSymbol.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCSymbol fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCVal.java b/src/main/java/org/stellar/sdk/xdr/SCVal.java index 18ac123c4..ff29d390e 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCVal.java +++ b/src/main/java/org/stellar/sdk/xdr/SCVal.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -667,7 +667,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -679,7 +679,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCVal fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCValType.java b/src/main/java/org/stellar/sdk/xdr/SCValType.java index 8a186750c..90677ab53 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCValType.java +++ b/src/main/java/org/stellar/sdk/xdr/SCValType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -164,7 +164,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -176,7 +176,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCValType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SCVec.java b/src/main/java/org/stellar/sdk/xdr/SCVec.java index 3de069d23..f39cef85c 100644 --- a/src/main/java/org/stellar/sdk/xdr/SCVec.java +++ b/src/main/java/org/stellar/sdk/xdr/SCVec.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -72,7 +72,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -84,7 +84,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SCVec fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SendMore.java b/src/main/java/org/stellar/sdk/xdr/SendMore.java index a9c02b09d..ed0a2f4be 100644 --- a/src/main/java/org/stellar/sdk/xdr/SendMore.java +++ b/src/main/java/org/stellar/sdk/xdr/SendMore.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SendMore fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SendMoreExtended.java b/src/main/java/org/stellar/sdk/xdr/SendMoreExtended.java index 95a345899..d064c94a0 100644 --- a/src/main/java/org/stellar/sdk/xdr/SendMoreExtended.java +++ b/src/main/java/org/stellar/sdk/xdr/SendMoreExtended.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SendMoreExtended fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SequenceNumber.java b/src/main/java/org/stellar/sdk/xdr/SequenceNumber.java index e7c6e02f6..c9b272124 100644 --- a/src/main/java/org/stellar/sdk/xdr/SequenceNumber.java +++ b/src/main/java/org/stellar/sdk/xdr/SequenceNumber.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SequenceNumber fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SetOptionsOp.java b/src/main/java/org/stellar/sdk/xdr/SetOptionsOp.java index c34720e5e..ab0bb652f 100644 --- a/src/main/java/org/stellar/sdk/xdr/SetOptionsOp.java +++ b/src/main/java/org/stellar/sdk/xdr/SetOptionsOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -264,7 +264,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -276,7 +276,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SetOptionsOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SetOptionsResult.java b/src/main/java/org/stellar/sdk/xdr/SetOptionsResult.java index 068a83427..018113c58 100644 --- a/src/main/java/org/stellar/sdk/xdr/SetOptionsResult.java +++ b/src/main/java/org/stellar/sdk/xdr/SetOptionsResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -124,7 +124,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -136,7 +136,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SetOptionsResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SetOptionsResultCode.java b/src/main/java/org/stellar/sdk/xdr/SetOptionsResultCode.java index be73b41b9..9223c98fc 100644 --- a/src/main/java/org/stellar/sdk/xdr/SetOptionsResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/SetOptionsResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -95,7 +95,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -107,7 +107,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SetOptionsResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsOp.java b/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsOp.java index 6766e4fcd..73583e9ff 100644 --- a/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsOp.java +++ b/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsOp.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -108,7 +108,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -120,7 +120,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SetTrustLineFlagsOp fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResult.java b/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResult.java index 4ded3bedc..c54cfcdb9 100644 --- a/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResult.java +++ b/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -110,7 +110,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -122,7 +122,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SetTrustLineFlagsResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResultCode.java b/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResultCode.java index 7deb5e653..58bf55d23 100644 --- a/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/SetTrustLineFlagsResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SetTrustLineFlagsResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Signature.java b/src/main/java/org/stellar/sdk/xdr/Signature.java index 42103a825..de22b8701 100644 --- a/src/main/java/org/stellar/sdk/xdr/Signature.java +++ b/src/main/java/org/stellar/sdk/xdr/Signature.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -81,7 +81,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Signature fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SignatureHint.java b/src/main/java/org/stellar/sdk/xdr/SignatureHint.java index 28e138563..349c82e16 100644 --- a/src/main/java/org/stellar/sdk/xdr/SignatureHint.java +++ b/src/main/java/org/stellar/sdk/xdr/SignatureHint.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SignatureHint fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SignedSurveyRequestMessage.java b/src/main/java/org/stellar/sdk/xdr/SignedSurveyRequestMessage.java index ba6c35ec5..478ba9176 100644 --- a/src/main/java/org/stellar/sdk/xdr/SignedSurveyRequestMessage.java +++ b/src/main/java/org/stellar/sdk/xdr/SignedSurveyRequestMessage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SignedSurveyRequestMessage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SignedSurveyResponseMessage.java b/src/main/java/org/stellar/sdk/xdr/SignedSurveyResponseMessage.java index 85c1083ea..605b7eea8 100644 --- a/src/main/java/org/stellar/sdk/xdr/SignedSurveyResponseMessage.java +++ b/src/main/java/org/stellar/sdk/xdr/SignedSurveyResponseMessage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -80,7 +80,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -92,7 +92,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SignedSurveyResponseMessage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Signer.java b/src/main/java/org/stellar/sdk/xdr/Signer.java index 1d8918247..1e8bbbe48 100644 --- a/src/main/java/org/stellar/sdk/xdr/Signer.java +++ b/src/main/java/org/stellar/sdk/xdr/Signer.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Signer fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SignerKey.java b/src/main/java/org/stellar/sdk/xdr/SignerKey.java index 9a73e3a8d..5e7a4f6bb 100644 --- a/src/main/java/org/stellar/sdk/xdr/SignerKey.java +++ b/src/main/java/org/stellar/sdk/xdr/SignerKey.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -199,7 +199,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -211,7 +211,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SignerKey fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -287,7 +287,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -299,7 +299,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SignerKeyEd25519SignedPayload fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SignerKeyType.java b/src/main/java/org/stellar/sdk/xdr/SignerKeyType.java index 90453dcf0..120c6da49 100644 --- a/src/main/java/org/stellar/sdk/xdr/SignerKeyType.java +++ b/src/main/java/org/stellar/sdk/xdr/SignerKeyType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -63,7 +63,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -75,7 +75,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SignerKeyType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SimplePaymentResult.java b/src/main/java/org/stellar/sdk/xdr/SimplePaymentResult.java index 43825f1e7..7b0b820bb 100644 --- a/src/main/java/org/stellar/sdk/xdr/SimplePaymentResult.java +++ b/src/main/java/org/stellar/sdk/xdr/SimplePaymentResult.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SimplePaymentResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanAddressCredentials.java b/src/main/java/org/stellar/sdk/xdr/SorobanAddressCredentials.java index 1d1ddd442..5ea68febe 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanAddressCredentials.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanAddressCredentials.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -107,7 +107,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -119,7 +119,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanAddressCredentials fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizationEntry.java b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizationEntry.java index 49476b3f7..f2dab3104 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizationEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizationEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanAuthorizationEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunction.java b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunction.java index f36d5cbe7..6e56058b4 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunction.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunction.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -138,7 +138,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -150,7 +150,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanAuthorizedFunction fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunctionType.java b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunctionType.java index d1d22f9fe..918a263fd 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunctionType.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedFunctionType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanAuthorizedFunctionType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedInvocation.java b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedInvocation.java index 3e874354d..5174830e5 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedInvocation.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanAuthorizedInvocation.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -92,7 +92,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -104,7 +104,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanAuthorizedInvocation fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanCredentials.java b/src/main/java/org/stellar/sdk/xdr/SorobanCredentials.java index e982dc68d..0755b6259 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanCredentials.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanCredentials.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -116,7 +116,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -128,7 +128,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanCredentials fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanCredentialsType.java b/src/main/java/org/stellar/sdk/xdr/SorobanCredentialsType.java index 80718d95d..00914d9ce 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanCredentialsType.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanCredentialsType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanCredentialsType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanResources.java b/src/main/java/org/stellar/sdk/xdr/SorobanResources.java index 7197024d2..6dbea6883 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanResources.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanResources.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -111,7 +111,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -123,7 +123,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanResources fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java b/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java index 1885f4450..66a21113d 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -94,7 +94,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -106,7 +106,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanTransactionData fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanTransactionMeta.java b/src/main/java/org/stellar/sdk/xdr/SorobanTransactionMeta.java index 5fea572eb..dc7edadf9 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanTransactionMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanTransactionMeta.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -134,7 +134,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -146,7 +146,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SorobanTransactionMeta fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SponsorshipDescriptor.java b/src/main/java/org/stellar/sdk/xdr/SponsorshipDescriptor.java index a02fd20f4..40b3eca44 100644 --- a/src/main/java/org/stellar/sdk/xdr/SponsorshipDescriptor.java +++ b/src/main/java/org/stellar/sdk/xdr/SponsorshipDescriptor.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -74,7 +74,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -86,7 +86,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SponsorshipDescriptor fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java b/src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java index f9ac799c8..bb508584b 100644 --- a/src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java +++ b/src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -195,7 +195,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -207,7 +207,7 @@ public byte[] toXdrByteArray() throws IOException { } public static StateExpirationSettings fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/StellarMessage.java b/src/main/java/org/stellar/sdk/xdr/StellarMessage.java index 0ab193c4b..29c15c4b9 100644 --- a/src/main/java/org/stellar/sdk/xdr/StellarMessage.java +++ b/src/main/java/org/stellar/sdk/xdr/StellarMessage.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -626,7 +626,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -638,7 +638,7 @@ public byte[] toXdrByteArray() throws IOException { } public static StellarMessage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/StellarValue.java b/src/main/java/org/stellar/sdk/xdr/StellarValue.java index 3aa932c61..8e1d40567 100644 --- a/src/main/java/org/stellar/sdk/xdr/StellarValue.java +++ b/src/main/java/org/stellar/sdk/xdr/StellarValue.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -130,7 +130,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -142,7 +142,7 @@ public byte[] toXdrByteArray() throws IOException { } public static StellarValue fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -283,7 +283,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -295,7 +295,7 @@ public byte[] toXdrByteArray() throws IOException { } public static StellarValueExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/StellarValueType.java b/src/main/java/org/stellar/sdk/xdr/StellarValueType.java index 8af9f42a7..19d3a9ad1 100644 --- a/src/main/java/org/stellar/sdk/xdr/StellarValueType.java +++ b/src/main/java/org/stellar/sdk/xdr/StellarValueType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -55,7 +55,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -67,7 +67,7 @@ public byte[] toXdrByteArray() throws IOException { } public static StellarValueType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/StoredTransactionSet.java b/src/main/java/org/stellar/sdk/xdr/StoredTransactionSet.java index ae0839212..6a9c5465b 100644 --- a/src/main/java/org/stellar/sdk/xdr/StoredTransactionSet.java +++ b/src/main/java/org/stellar/sdk/xdr/StoredTransactionSet.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -138,7 +138,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -150,7 +150,7 @@ public byte[] toXdrByteArray() throws IOException { } public static StoredTransactionSet fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/String32.java b/src/main/java/org/stellar/sdk/xdr/String32.java index 21182a0b8..bbbd8c324 100644 --- a/src/main/java/org/stellar/sdk/xdr/String32.java +++ b/src/main/java/org/stellar/sdk/xdr/String32.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static String32 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/String64.java b/src/main/java/org/stellar/sdk/xdr/String64.java index 9fc11681a..3fa560feb 100644 --- a/src/main/java/org/stellar/sdk/xdr/String64.java +++ b/src/main/java/org/stellar/sdk/xdr/String64.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static String64 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SurveyMessageCommandType.java b/src/main/java/org/stellar/sdk/xdr/SurveyMessageCommandType.java index 0c2d57183..b68426e46 100644 --- a/src/main/java/org/stellar/sdk/xdr/SurveyMessageCommandType.java +++ b/src/main/java/org/stellar/sdk/xdr/SurveyMessageCommandType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -52,7 +52,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -64,7 +64,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SurveyMessageCommandType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SurveyMessageResponseType.java b/src/main/java/org/stellar/sdk/xdr/SurveyMessageResponseType.java index 95b33dc5e..b85e1a57e 100644 --- a/src/main/java/org/stellar/sdk/xdr/SurveyMessageResponseType.java +++ b/src/main/java/org/stellar/sdk/xdr/SurveyMessageResponseType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -56,7 +56,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -68,7 +68,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SurveyMessageResponseType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SurveyRequestMessage.java b/src/main/java/org/stellar/sdk/xdr/SurveyRequestMessage.java index a4172172b..93a38ac61 100644 --- a/src/main/java/org/stellar/sdk/xdr/SurveyRequestMessage.java +++ b/src/main/java/org/stellar/sdk/xdr/SurveyRequestMessage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -126,7 +126,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -138,7 +138,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SurveyRequestMessage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SurveyResponseBody.java b/src/main/java/org/stellar/sdk/xdr/SurveyResponseBody.java index 1f5217d97..2ce3e9062 100644 --- a/src/main/java/org/stellar/sdk/xdr/SurveyResponseBody.java +++ b/src/main/java/org/stellar/sdk/xdr/SurveyResponseBody.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -137,7 +137,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -149,7 +149,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SurveyResponseBody fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/SurveyResponseMessage.java b/src/main/java/org/stellar/sdk/xdr/SurveyResponseMessage.java index cc8ee37bc..845e2ed66 100644 --- a/src/main/java/org/stellar/sdk/xdr/SurveyResponseMessage.java +++ b/src/main/java/org/stellar/sdk/xdr/SurveyResponseMessage.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -126,7 +126,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -138,7 +138,7 @@ public byte[] toXdrByteArray() throws IOException { } public static SurveyResponseMessage fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/ThresholdIndexes.java b/src/main/java/org/stellar/sdk/xdr/ThresholdIndexes.java index eb7ced745..e96dbc6af 100644 --- a/src/main/java/org/stellar/sdk/xdr/ThresholdIndexes.java +++ b/src/main/java/org/stellar/sdk/xdr/ThresholdIndexes.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -63,7 +63,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -75,7 +75,7 @@ public byte[] toXdrByteArray() throws IOException { } public static ThresholdIndexes fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Thresholds.java b/src/main/java/org/stellar/sdk/xdr/Thresholds.java index 288853d4c..e3a864d43 100644 --- a/src/main/java/org/stellar/sdk/xdr/Thresholds.java +++ b/src/main/java/org/stellar/sdk/xdr/Thresholds.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Thresholds fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TimeBounds.java b/src/main/java/org/stellar/sdk/xdr/TimeBounds.java index f7d00a24b..457fec2af 100644 --- a/src/main/java/org/stellar/sdk/xdr/TimeBounds.java +++ b/src/main/java/org/stellar/sdk/xdr/TimeBounds.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TimeBounds fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TimePoint.java b/src/main/java/org/stellar/sdk/xdr/TimePoint.java index e093806fc..be18c01ca 100644 --- a/src/main/java/org/stellar/sdk/xdr/TimePoint.java +++ b/src/main/java/org/stellar/sdk/xdr/TimePoint.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -65,7 +65,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -77,7 +77,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TimePoint fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV0.java b/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV0.java index ad3b33eb3..8fd924fcf 100644 --- a/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV0.java +++ b/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV0.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -112,7 +112,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -124,7 +124,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TopologyResponseBodyV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV1.java b/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV1.java index cc9713013..262dfaaef 100644 --- a/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV1.java +++ b/src/main/java/org/stellar/sdk/xdr/TopologyResponseBodyV1.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -143,7 +143,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -155,7 +155,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TopologyResponseBodyV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Transaction.java b/src/main/java/org/stellar/sdk/xdr/Transaction.java index b5896d5b2..b06ff66b5 100644 --- a/src/main/java/org/stellar/sdk/xdr/Transaction.java +++ b/src/main/java/org/stellar/sdk/xdr/Transaction.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -182,7 +182,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -194,7 +194,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Transaction fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -355,7 +355,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -367,7 +367,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionEnvelope.java b/src/main/java/org/stellar/sdk/xdr/TransactionEnvelope.java index b8c9fe213..b1dfcefde 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionEnvelope.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionEnvelope.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -164,7 +164,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -176,7 +176,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionEnvelope fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionHistoryEntry.java b/src/main/java/org/stellar/sdk/xdr/TransactionHistoryEntry.java index 3b3bc9d16..fe38b4254 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionHistoryEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionHistoryEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -102,7 +102,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -114,7 +114,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionHistoryEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -252,7 +252,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -264,7 +264,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionHistoryEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionHistoryResultEntry.java b/src/main/java/org/stellar/sdk/xdr/TransactionHistoryResultEntry.java index 3f85fdfaf..0ab1e7451 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionHistoryResultEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionHistoryResultEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -102,7 +102,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -114,7 +114,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionHistoryResultEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -228,7 +228,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -240,7 +240,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionHistoryResultEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionMeta.java b/src/main/java/org/stellar/sdk/xdr/TransactionMeta.java index a5f901e5f..1fac83f90 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionMeta.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -198,7 +198,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -210,7 +210,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionMeta fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionMetaV1.java b/src/main/java/org/stellar/sdk/xdr/TransactionMetaV1.java index 304753da3..4c178b6d2 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionMetaV1.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionMetaV1.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionMetaV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionMetaV2.java b/src/main/java/org/stellar/sdk/xdr/TransactionMetaV2.java index c7f68ba44..e8b610efd 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionMetaV2.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionMetaV2.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -104,7 +104,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -116,7 +116,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionMetaV2 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionMetaV3.java b/src/main/java/org/stellar/sdk/xdr/TransactionMetaV3.java index 33b525771..473fead46 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionMetaV3.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionMetaV3.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -146,7 +146,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -158,7 +158,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionMetaV3 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionPhase.java b/src/main/java/org/stellar/sdk/xdr/TransactionPhase.java index 8df20aff5..b18519ec8 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionPhase.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionPhase.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -119,7 +119,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -131,7 +131,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionPhase fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionResult.java b/src/main/java/org/stellar/sdk/xdr/TransactionResult.java index f4acced97..d5182ea23 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionResult.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionResult.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -127,7 +127,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -139,7 +139,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -339,7 +339,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -351,7 +351,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResultResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -434,7 +434,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -446,7 +446,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResultExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionResultCode.java b/src/main/java/org/stellar/sdk/xdr/TransactionResultCode.java index b8fe71cd7..89b196529 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionResultCode.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -128,7 +128,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -140,7 +140,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResultCode fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionResultMeta.java b/src/main/java/org/stellar/sdk/xdr/TransactionResultMeta.java index a1c031ba4..4713373f6 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionResultMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionResultMeta.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -93,7 +93,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -105,7 +105,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResultMeta fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionResultPair.java b/src/main/java/org/stellar/sdk/xdr/TransactionResultPair.java index 3ba025093..d5d62e0a5 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionResultPair.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionResultPair.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -79,7 +79,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -91,7 +91,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResultPair fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionResultSet.java b/src/main/java/org/stellar/sdk/xdr/TransactionResultSet.java index 4c06be4f1..7743f6d8f 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionResultSet.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionResultSet.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionResultSet fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionSet.java b/src/main/java/org/stellar/sdk/xdr/TransactionSet.java index 8719f592c..2077eb4ab 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionSet.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionSet.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionSet fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionSetV1.java b/src/main/java/org/stellar/sdk/xdr/TransactionSetV1.java index 3fcd7d818..e87f14500 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionSetV1.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionSetV1.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -87,7 +87,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -99,7 +99,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionSetV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionSignaturePayload.java b/src/main/java/org/stellar/sdk/xdr/TransactionSignaturePayload.java index 88820c66b..67c69e13d 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionSignaturePayload.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionSignaturePayload.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -90,7 +90,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -102,7 +102,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionSignaturePayload fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -261,7 +261,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -274,7 +274,7 @@ public byte[] toXdrByteArray() throws IOException { public static TransactionSignaturePayloadTaggedTransaction fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionV0.java b/src/main/java/org/stellar/sdk/xdr/TransactionV0.java index 9b7d5228f..78d65afc1 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionV0.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionV0.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -177,7 +177,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -189,7 +189,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionV0 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -327,7 +327,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -339,7 +339,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionV0Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionV0Envelope.java b/src/main/java/org/stellar/sdk/xdr/TransactionV0Envelope.java index 51b1b870d..b9267ac19 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionV0Envelope.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionV0Envelope.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -89,7 +89,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -101,7 +101,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionV0Envelope fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TransactionV1Envelope.java b/src/main/java/org/stellar/sdk/xdr/TransactionV1Envelope.java index 6ea151351..c2356e0d0 100644 --- a/src/main/java/org/stellar/sdk/xdr/TransactionV1Envelope.java +++ b/src/main/java/org/stellar/sdk/xdr/TransactionV1Envelope.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -89,7 +89,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -101,7 +101,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TransactionV1Envelope fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TrustLineAsset.java b/src/main/java/org/stellar/sdk/xdr/TrustLineAsset.java index 00e588e4b..554038821 100644 --- a/src/main/java/org/stellar/sdk/xdr/TrustLineAsset.java +++ b/src/main/java/org/stellar/sdk/xdr/TrustLineAsset.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -174,7 +174,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -186,7 +186,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineAsset fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TrustLineEntry.java b/src/main/java/org/stellar/sdk/xdr/TrustLineEntry.java index ee1fc1271..852b0a7a0 100644 --- a/src/main/java/org/stellar/sdk/xdr/TrustLineEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/TrustLineEntry.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -157,7 +157,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -169,7 +169,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineEntry fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -323,7 +323,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -335,7 +335,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineEntryExt fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -403,7 +403,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -415,7 +415,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineEntryV1 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -542,7 +542,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -554,7 +554,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineEntryV1Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TrustLineEntryExtensionV2.java b/src/main/java/org/stellar/sdk/xdr/TrustLineEntryExtensionV2.java index 57f7b0e2c..f6073d022 100644 --- a/src/main/java/org/stellar/sdk/xdr/TrustLineEntryExtensionV2.java +++ b/src/main/java/org/stellar/sdk/xdr/TrustLineEntryExtensionV2.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -85,7 +85,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -97,7 +97,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineEntryExtensionV2 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -204,7 +204,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -216,7 +216,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineEntryExtensionV2Ext fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TrustLineFlags.java b/src/main/java/org/stellar/sdk/xdr/TrustLineFlags.java index 78df565f5..76f69b7c0 100644 --- a/src/main/java/org/stellar/sdk/xdr/TrustLineFlags.java +++ b/src/main/java/org/stellar/sdk/xdr/TrustLineFlags.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TrustLineFlags fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TxAdvertVector.java b/src/main/java/org/stellar/sdk/xdr/TxAdvertVector.java index 347eae01b..b1c9a5c29 100644 --- a/src/main/java/org/stellar/sdk/xdr/TxAdvertVector.java +++ b/src/main/java/org/stellar/sdk/xdr/TxAdvertVector.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TxAdvertVector fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TxDemandVector.java b/src/main/java/org/stellar/sdk/xdr/TxDemandVector.java index 7d7d9f989..1464e760b 100644 --- a/src/main/java/org/stellar/sdk/xdr/TxDemandVector.java +++ b/src/main/java/org/stellar/sdk/xdr/TxDemandVector.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -73,7 +73,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -85,7 +85,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TxDemandVector fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TxSetComponent.java b/src/main/java/org/stellar/sdk/xdr/TxSetComponent.java index ea7cf8189..11c56e99c 100644 --- a/src/main/java/org/stellar/sdk/xdr/TxSetComponent.java +++ b/src/main/java/org/stellar/sdk/xdr/TxSetComponent.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -119,7 +119,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -131,7 +131,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TxSetComponent fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } @@ -218,7 +218,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -230,7 +230,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TxSetComponentTxsMaybeDiscountedFee fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/TxSetComponentType.java b/src/main/java/org/stellar/sdk/xdr/TxSetComponentType.java index 840db4bb7..01b4c39ae 100644 --- a/src/main/java/org/stellar/sdk/xdr/TxSetComponentType.java +++ b/src/main/java/org/stellar/sdk/xdr/TxSetComponentType.java @@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -54,7 +54,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -66,7 +66,7 @@ public byte[] toXdrByteArray() throws IOException { } public static TxSetComponentType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/UInt128Parts.java b/src/main/java/org/stellar/sdk/xdr/UInt128Parts.java index e5516d05d..6c560e497 100644 --- a/src/main/java/org/stellar/sdk/xdr/UInt128Parts.java +++ b/src/main/java/org/stellar/sdk/xdr/UInt128Parts.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -76,7 +76,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -88,7 +88,7 @@ public byte[] toXdrByteArray() throws IOException { } public static UInt128Parts fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/UInt256Parts.java b/src/main/java/org/stellar/sdk/xdr/UInt256Parts.java index 2b97e6a47..56f6d84f0 100644 --- a/src/main/java/org/stellar/sdk/xdr/UInt256Parts.java +++ b/src/main/java/org/stellar/sdk/xdr/UInt256Parts.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -105,7 +105,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -117,7 +117,7 @@ public byte[] toXdrByteArray() throws IOException { } public static UInt256Parts fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Uint256.java b/src/main/java/org/stellar/sdk/xdr/Uint256.java index bc6dd91af..504ea538e 100644 --- a/src/main/java/org/stellar/sdk/xdr/Uint256.java +++ b/src/main/java/org/stellar/sdk/xdr/Uint256.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -67,7 +67,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -79,7 +79,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Uint256 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Uint32.java b/src/main/java/org/stellar/sdk/xdr/Uint32.java index fc29d318f..e46bbf8ec 100644 --- a/src/main/java/org/stellar/sdk/xdr/Uint32.java +++ b/src/main/java/org/stellar/sdk/xdr/Uint32.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Uint32 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Uint64.java b/src/main/java/org/stellar/sdk/xdr/Uint64.java index c12f13fbb..2250fe383 100644 --- a/src/main/java/org/stellar/sdk/xdr/Uint64.java +++ b/src/main/java/org/stellar/sdk/xdr/Uint64.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -64,7 +64,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -76,7 +76,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Uint64 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/UpgradeEntryMeta.java b/src/main/java/org/stellar/sdk/xdr/UpgradeEntryMeta.java index a690af049..00b3c459d 100644 --- a/src/main/java/org/stellar/sdk/xdr/UpgradeEntryMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/UpgradeEntryMeta.java @@ -8,8 +8,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -78,7 +78,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -90,7 +90,7 @@ public byte[] toXdrByteArray() throws IOException { } public static UpgradeEntryMeta fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/UpgradeType.java b/src/main/java/org/stellar/sdk/xdr/UpgradeType.java index 8acd939b1..bdafc9008 100644 --- a/src/main/java/org/stellar/sdk/xdr/UpgradeType.java +++ b/src/main/java/org/stellar/sdk/xdr/UpgradeType.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -69,7 +69,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -81,7 +81,7 @@ public byte[] toXdrByteArray() throws IOException { } public static UpgradeType fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/Value.java b/src/main/java/org/stellar/sdk/xdr/Value.java index 850f27806..826619625 100644 --- a/src/main/java/org/stellar/sdk/xdr/Value.java +++ b/src/main/java/org/stellar/sdk/xdr/Value.java @@ -9,7 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; // === xdr source ============================================================ @@ -68,7 +68,7 @@ public boolean equals(Object object) { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -80,7 +80,7 @@ public byte[] toXdrByteArray() throws IOException { } public static Value fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/XdrString.java b/src/main/java/org/stellar/sdk/xdr/XdrString.java index 3320d5bce..a08339459 100644 --- a/src/main/java/org/stellar/sdk/xdr/XdrString.java +++ b/src/main/java/org/stellar/sdk/xdr/XdrString.java @@ -6,7 +6,7 @@ import java.io.InvalidClassException; import java.nio.charset.Charset; import java.util.Arrays; -import java.util.Base64; +import org.stellar.sdk.Base64Factory; public class XdrString implements XdrElement { private byte[] bytes; @@ -41,7 +41,7 @@ public byte[] getBytes() { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -53,7 +53,7 @@ public byte[] toXdrByteArray() throws IOException { } public static XdrString fromXdrBase64(String xdr, int maxSize) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes, maxSize); } diff --git a/src/main/java/org/stellar/sdk/xdr/XdrUnsignedHyperInteger.java b/src/main/java/org/stellar/sdk/xdr/XdrUnsignedHyperInteger.java index 4c570cc4b..6c05ca57d 100644 --- a/src/main/java/org/stellar/sdk/xdr/XdrUnsignedHyperInteger.java +++ b/src/main/java/org/stellar/sdk/xdr/XdrUnsignedHyperInteger.java @@ -4,8 +4,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.math.BigInteger; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; /** * Represents XDR Unsigned Hyper Integer. @@ -61,7 +61,7 @@ public BigInteger getNumber() { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -73,7 +73,7 @@ public byte[] toXdrByteArray() throws IOException { } public static XdrUnsignedHyperInteger fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/main/java/org/stellar/sdk/xdr/XdrUnsignedInteger.java b/src/main/java/org/stellar/sdk/xdr/XdrUnsignedInteger.java index a3b037db6..8f2a52395 100644 --- a/src/main/java/org/stellar/sdk/xdr/XdrUnsignedInteger.java +++ b/src/main/java/org/stellar/sdk/xdr/XdrUnsignedInteger.java @@ -3,8 +3,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Base64; import java.util.Objects; +import org.stellar.sdk.Base64Factory; /** * Represents XDR Unsigned Integer. @@ -49,7 +49,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { @Override public String toXdrBase64() throws IOException { - return Base64.getEncoder().encodeToString(toXdrByteArray()); + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); } @Override @@ -61,7 +61,7 @@ public byte[] toXdrByteArray() throws IOException { } public static XdrUnsignedInteger fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64.getDecoder().decode(xdr); + byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } diff --git a/src/test/java/org/stellar/sdk/Sep10ChallengeTest.java b/src/test/java/org/stellar/sdk/Sep10ChallengeTest.java index 95ca1e0d9..da7a1ab28 100644 --- a/src/test/java/org/stellar/sdk/Sep10ChallengeTest.java +++ b/src/test/java/org/stellar/sdk/Sep10ChallengeTest.java @@ -287,7 +287,7 @@ public void testReadChallengeTransactionInvalidNotSignedByServer() throws IOExce byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation manageDataOperation1 = @@ -395,7 +395,7 @@ public void testReadChallengeTransactionInvalidSeqNoNotZero() throws IOException byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), 100L); ManageDataOperation manageDataOperation1 = @@ -440,7 +440,7 @@ public void testReadChallengeTransactionInvalidTimeboundsInfinite() throws IOExc byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation = @@ -610,7 +610,7 @@ public void testReadChallengeTransactionInvalidOperationNoSourceAccount() throws byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation manageDataOperation1 = @@ -653,7 +653,7 @@ public void testReadChallengeTransactionInvalidDataValueWrongEncodedLength() thr byte[] nonce = new byte[32]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation manageDataOperation1 = @@ -741,7 +741,7 @@ public void testReadChallengeTransactionInvalidDataValueWrongByteLength() throws byte[] nonce = new byte[47]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation manageDataOperation1 = @@ -827,7 +827,7 @@ public void testReadChallengeTransactionInvalidDataValueIsNull() throws IOExcept byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -875,7 +875,7 @@ public void testReadChallengeTransactionInvalidDataValueIsNull() throws IOExcept byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -923,7 +923,7 @@ public void testReadChallengeTransactionInvalidAdditionalManageDataOpsWithSource byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -968,7 +968,7 @@ public void testReadChallengeTransactionInvalidAdditionalOpsOfOtherTypes() throw byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -1219,7 +1219,7 @@ public void testReadChallengeTransactionInvalidWebAuthDomainOperationValueIsNull byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation domainNameOperation = @@ -1268,7 +1268,7 @@ public void testReadChallengeTransactionInvalidWebAuthDomainOperationValueIsNull byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation domainNameOperation = @@ -1515,7 +1515,7 @@ public void testVerifyChallengeTransactionThresholdInvalidNotSignedByServer() th byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation manageDataOperation1 = @@ -2064,7 +2064,7 @@ public void testVerifyChallengeTransactionSignersInvalidServer() throws IOExcept byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation manageDataOperation1 = @@ -2660,7 +2660,7 @@ public void testVerifyChallengeTransactionSignersInvalidNoSignersEmptySet() byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -2713,7 +2713,7 @@ public void testVerifyChallengeTransactionSignersInvalidNoSignersEmptySet() byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -2769,7 +2769,7 @@ public void testVerifyChallengeTransactionSignersInvalidNoSignersEmptySet() byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 = @@ -2821,7 +2821,7 @@ public void testVerifyChallengeTransactionInvalidAdditionalOpsOfOtherTypes() thr byte[] nonce = new byte[48]; SecureRandom random = new SecureRandom(); random.nextBytes(nonce); - byte[] encodedNonce = Base64.getEncoder().encode(nonce); + byte[] encodedNonce = java.util.Base64.getEncoder().encode(nonce); Account sourceAccount = new Account(server.getAccountId(), -1L); ManageDataOperation operation1 =