3232import com .hedera .pbj .runtime .io .buffer .Bytes ;
3333import edu .umd .cs .findbugs .annotations .NonNull ;
3434import edu .umd .cs .findbugs .annotations .Nullable ;
35- import java .io .IOException ;
3635import java .lang .invoke .MethodHandles ;
3736import java .lang .invoke .VarHandle ;
3837import java .nio .ByteOrder ;
@@ -138,15 +137,13 @@ public static int writeTag(
138137 * @param value the string value to write
139138 * @param skipDefault default value results in no-op for non-oneOf
140139 * @return the number of bytes written
141- * @throws IOException If a I/O error occurs
142140 */
143141 public static int writeString (
144142 @ NonNull byte [] output ,
145143 final int offset ,
146144 @ NonNull final FieldDefinition field ,
147145 final String value ,
148- final boolean skipDefault )
149- throws IOException {
146+ final boolean skipDefault ) {
150147 assert field .type () == FieldType .STRING : "Not a string type " + field ;
151148 assert !field .repeated () : "Use writeStringList with repeated types" ;
152149 return writeStringNoChecks (output , offset , field , value , skipDefault );
@@ -161,15 +158,13 @@ public static int writeString(
161158 * @param value the string value to write
162159 * @param skipDefault default value results in no-op for non-oneOf
163160 * @return the number of bytes written
164- * @throws IOException If a I/O error occurs
165161 */
166162 private static int writeStringNoChecks (
167163 @ NonNull byte [] output ,
168164 final int offset ,
169165 @ NonNull final FieldDefinition field ,
170166 final String value ,
171- final boolean skipDefault )
172- throws IOException {
167+ final boolean skipDefault ) {
173168 int bytesWritten = 0 ;
174169 // When not a oneOf don't write default value
175170 if (skipDefault && !field .oneOf () && (value == null || value .isEmpty ())) {
@@ -189,14 +184,12 @@ private static int writeStringNoChecks(
189184 * @param field the field definition for the string field
190185 * @param value the optional string value to write
191186 * @return the number of bytes written
192- * @throws IOException If a I/O error occurs
193187 */
194188 public static int writeOptionalString (
195189 @ NonNull byte [] output ,
196190 final int offset ,
197191 @ NonNull final FieldDefinition field ,
198- @ Nullable final String value )
199- throws IOException {
192+ @ Nullable final String value ) {
200193 int bytesWritten = 0 ;
201194 if (value != null ) {
202195 bytesWritten += writeTag (output , offset , field , WIRE_TYPE_DELIMITED );
@@ -663,15 +656,13 @@ public static int writeEnum(
663656 * @param message the message to write
664657 * @param codec the codec for the given message type
665658 * @return the number of bytes written
666- * @throws IOException If a I/O error occurs
667659 */
668660 public static <T > int writeMessage (
669661 @ NonNull final byte [] output ,
670662 final int offset ,
671663 @ NonNull final FieldDefinition field ,
672664 final T message ,
673- final Codec <T > codec )
674- throws IOException {
665+ final Codec <T > codec ) {
675666 assert field .type () == FieldType .MESSAGE : "Not a message type " + field ;
676667 assert !field .repeated () : "Use writeMessageList with repeated types" ;
677668 return writeMessageNoChecks (output , offset , field , message , codec );
@@ -687,15 +678,13 @@ public static <T> int writeMessage(
687678 * @param message the message to write
688679 * @param codec the codec for the given message type
689680 * @return the number of bytes written
690- * @throws IOException If a I/O error occurs
691681 */
692682 private static <T > int writeMessageNoChecks (
693683 @ NonNull final byte [] output ,
694684 final int offset ,
695685 @ NonNull final FieldDefinition field ,
696686 final T message ,
697- final Codec <T > codec )
698- throws IOException {
687+ final Codec <T > codec ) {
699688 // When not a oneOf don't write default value
700689 int bytesWritten = 0 ;
701690 if (field .oneOf () && message == null ) {
@@ -722,15 +711,13 @@ private static <T> int writeMessageNoChecks(
722711 * @param value the bytes value to write
723712 * @param skipDefault default value results in no-op for non-oneOf
724713 * @return the number of bytes written
725- * @throws IOException If a I/O error occurs
726714 */
727715 public static int writeBytes (
728716 @ NonNull final byte [] output ,
729717 final int offset ,
730718 @ NonNull final FieldDefinition field ,
731719 final Bytes value ,
732- boolean skipDefault )
733- throws IOException {
720+ boolean skipDefault ) {
734721 assert field .type () == FieldType .BYTES : "Not a byte[] type " + field ;
735722 assert !field .repeated () : "Use writeBytesList with repeated types" ;
736723 return writeBytesNoChecks (output , offset , field , value , skipDefault );
@@ -745,15 +732,13 @@ public static int writeBytes(
745732 * @param value the bytes value to write
746733 * @param skipZeroLength this is true for normal single bytes and false for repeated lists
747734 * @return the number of bytes written
748- * @throws IOException If a I/O error occurs
749735 */
750736 private static int writeBytesNoChecks (
751737 @ NonNull final byte [] output ,
752738 final int offset ,
753739 @ NonNull final FieldDefinition field ,
754740 final Bytes value ,
755- final boolean skipZeroLength )
756- throws IOException {
741+ final boolean skipZeroLength ) {
757742 // When not a oneOf don't write default value
758743 if (!field .oneOf () && (skipZeroLength && (value .length () == 0 ))) {
759744 return 0 ;
@@ -1100,11 +1085,9 @@ public static int writeEnumList(
11001085 * @param field the descriptor for the field we are writing
11011086 * @param list the list of strings value to write
11021087 * @return the number of bytes written
1103- * @throws IOException If a I/O error occurs
11041088 */
11051089 public static int writeStringList (
1106- @ NonNull final byte [] output , final int offset , FieldDefinition field , List <String > list )
1107- throws IOException {
1090+ @ NonNull final byte [] output , final int offset , FieldDefinition field , List <String > list ) {
11081091 assert field .type () == FieldType .STRING : "Not a string type " + field ;
11091092 assert field .repeated () : "Use writeString with non-repeated types" ;
11101093 // When not a oneOf don't write default value
@@ -1131,12 +1114,10 @@ public static int writeStringList(
11311114 * @param list the list of messages value to write
11321115 * @param codec the codec for the message type
11331116 * @return the number of bytes written
1134- * @throws IOException If a I/O error occurs
11351117 * @param <T> type of message
11361118 */
11371119 public static <T > int writeMessageList (
1138- @ NonNull final byte [] output , final int offset , FieldDefinition field , List <T > list , Codec <T > codec )
1139- throws IOException {
1120+ @ NonNull final byte [] output , final int offset , FieldDefinition field , List <T > list , Codec <T > codec ) {
11401121 assert field .type () == FieldType .MESSAGE : "Not a message type " + field ;
11411122 assert field .repeated () : "Use writeMessage with non-repeated types" ;
11421123 // When not a oneOf don't write default value
@@ -1159,11 +1140,9 @@ public static <T> int writeMessageList(
11591140 * @param field the descriptor for the field we are writing
11601141 * @param list the list of bytes objects value to write
11611142 * @return the number of bytes written
1162- * @throws IOException If a I/O error occurs
11631143 */
11641144 public static int writeBytesList (
1165- @ NonNull final byte [] output , final int offset , FieldDefinition field , List <? extends Bytes > list )
1166- throws IOException {
1145+ @ NonNull final byte [] output , final int offset , FieldDefinition field , List <? extends Bytes > list ) {
11671146 assert field .type () == FieldType .BYTES : "Not a message type " + field ;
11681147 assert field .repeated () : "Use writeBytes with non-repeated types" ;
11691148 // When not a oneOf don't write default value
0 commit comments