File tree Expand file tree Collapse file tree
src/main/java/org/glavo/nbt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,10 +26,15 @@ public record SNBTCodecImpl() implements SNBTCodec {
2626 public static final SNBTCodecImpl DEFAULT = new SNBTCodecImpl ();
2727
2828 @ Override
29- public Tag parseTag (CharSequence input , int startInclusive , int endExclusive ) throws IllegalArgumentException {
30- Tag tag = new SNBTParser (input , startInclusive , endExclusive ).nextTag ();
29+ public Tag readTag (CharSequence input , int startInclusive , int endExclusive ) throws IOException {
30+ Tag tag ;
31+ try {
32+ tag = new SNBTParser (input , startInclusive , endExclusive ).nextTag ();
33+ } catch (IllegalArgumentException e ) {
34+ throw new IOException (e );
35+ }
3136 if (tag == null ) {
32- throw new IllegalArgumentException ("Unexpected end of input" );
37+ throw new IOException ("Unexpected end of input" );
3338 }
3439 return tag ;
3540 }
@@ -45,7 +50,7 @@ public Tag readTag(Readable readable) throws IOException {
4550 buffer .clear ();
4651 }
4752 try {
48- return parseTag (builder );
53+ return readTag (builder );
4954 } catch (IllegalArgumentException e ) {
5055 throw new IOException (e );
5156 }
Original file line number Diff line number Diff line change @@ -33,18 +33,18 @@ static SNBTCodec of() {
3333
3434 /// Parses a Stringified NBT data.
3535 ///
36- /// @throws IllegalArgumentException if the input is not a valid Stringified NBT data.
36+ /// @throws IOException if the input is not a valid Stringified NBT data.
3737 @ Contract (pure = true )
38- default Tag parseTag (CharSequence input ) throws IllegalArgumentException {
39- return parseTag (input , 0 , input .length ());
38+ default Tag readTag (CharSequence input ) throws IOException {
39+ return readTag (input , 0 , input .length ());
4040 }
4141
4242 /// Parses a Stringified NBT data.
4343 ///
4444 /// @throws IndexOutOfBoundsException if the range is out of bounds.
45- /// @throws IllegalArgumentException if the input is not a valid Stringified NBT data.
45+ /// @throws IOException if the input is not a valid Stringified NBT data.
4646 @ Contract (pure = true )
47- Tag parseTag (CharSequence input , int startInclusive , int endExclusive ) throws IllegalArgumentException ;
47+ Tag readTag (CharSequence input , int startInclusive , int endExclusive ) throws IOException ;
4848
4949 /// Reads a Stringified NBT data from a readable source.
5050 ///
You can’t perform that action at this time.
0 commit comments