cleishm commented on a change in pull request #19: SSZ v0.5.0 Related Changes
URL: https://github.com/apache/incubator-tuweni/pull/19#discussion_r292531631
##########
File path: ssz/src/main/java/org/apache/tuweni/ssz/SSZReader.java
##########
@@ -51,6 +51,32 @@ default Bytes readBytes() {
*/
Bytes readBytes(int limit);
+ /**
+ * Read a known size fixed-length bytes value from the SSZ source.
+ *
+ * Note: prefer to use {@link #readFixedBytes(int, int)} instead, especially
when reading untrusted data.
+ *
+ * @param byteLength The number of fixed-length Bytes (no length mixin) to
read.
+ * @return The bytes for the next value.
+ * @throws InvalidSSZTypeException If the next SSZ value is not a byte
array, or is too large (greater than 2^32
+ * bytes).
+ * @throws EndOfSSZException If there are no more SSZ values to read.
+ */
+ default Bytes readFixedBytes(int byteLength) {
+ return readFixedBytes(byteLength, Integer.MAX_VALUE);
+ }
+
+ /**
+ * Read a known size fixed-length bytes value from the SSZ source.
+ *
+ * @param byteLength The number of fixed-length Bytes (no length mixin) to
read.
Review comment:
`length mixin` doesn't mean much to the consumer of this API.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]