@Test public void testStaticArray() { assertThat(TypeDecoder.decodeStaticArray( "000000000000000000000000000000000000000000000000000000000000000a" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {}, 2), is(new StaticArray<Uint256>( new Uint256(BigInteger.TEN), new Uint256(BigInteger.valueOf(Long.MAX_VALUE))))); assertThat(TypeDecoder.decodeStaticArray( "000000000000000000000000000000000000000000000000000000000000000d" + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000d" + "776f726c64212048656c6c6f2c00000000000000000000000000000000000000", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Utf8String>>(2){}, 2 ), equalTo(new StaticArray<Utf8String>( new Utf8String("Hello, world!"), new Utf8String("world! Hello,")))); }
@SuppressWarnings("unchecked") static <T extends Type> T decodeStaticArray( String input, int offset, TypeReference<T> typeReference, int length) { BiFunction<List<T>, String, T> function = (elements, typeName) -> { if (elements.isEmpty()) { throw new UnsupportedOperationException("Zero length fixed array is invalid type"); } else { return instantiateStaticArray(typeReference, elements); } }; return decodeArrayElements(input, offset, typeReference, length, function); }
TypeDecoder { @SuppressWarnings("unchecked") static <T extends Type> T decodeStaticArray( String input, int offset, TypeReference<T> typeReference, int length) { BiFunction<List<T>, String, T> function = (elements, typeName) -> { if (elements.isEmpty()) { throw new UnsupportedOperationException("Zero length fixed array is invalid type"); } else { return instantiateStaticArray(typeReference, elements); } }; return decodeArrayElements(input, offset, typeReference, length, function); } }
TypeDecoder { @SuppressWarnings("unchecked") static <T extends Type> T decodeStaticArray( String input, int offset, TypeReference<T> typeReference, int length) { BiFunction<List<T>, String, T> function = (elements, typeName) -> { if (elements.isEmpty()) { throw new UnsupportedOperationException("Zero length fixed array is invalid type"); } else { return instantiateStaticArray(typeReference, elements); } }; return decodeArrayElements(input, offset, typeReference, length, function); }  }
TypeDecoder { @SuppressWarnings("unchecked") static <T extends Type> T decodeStaticArray( String input, int offset, TypeReference<T> typeReference, int length) { BiFunction<List<T>, String, T> function = (elements, typeName) -> { if (elements.isEmpty()) { throw new UnsupportedOperationException("Zero length fixed array is invalid type"); } else { return instantiateStaticArray(typeReference, elements); } }; return decodeArrayElements(input, offset, typeReference, length, function); }  static T decode(
            String input, int offset, TypeReference<T> typeReference); }
TypeDecoder { @SuppressWarnings("unchecked") static <T extends Type> T decodeStaticArray( String input, int offset, TypeReference<T> typeReference, int length) { BiFunction<List<T>, String, T> function = (elements, typeName) -> { if (elements.isEmpty()) { throw new UnsupportedOperationException("Zero length fixed array is invalid type"); } else { return instantiateStaticArray(typeReference, elements); } }; return decodeArrayElements(input, offset, typeReference, length, function); }  static T decode(
            String input, int offset, TypeReference<T> typeReference);  }