Interface TagLimiter


public interface TagLimiter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the amount of currently read bytes.
    void
    checkLevel(int nestedLevel)
    Checks the current level of nesting and throws an exception if it exceeds the max levels.
    default void
     
    void
    countBytes(int bytes)
    Counts the given number of bytes and throws an exception if the max bytes count is exceeded.
    default void
     
    default void
     
    default void
     
    default void
     
    default void
     
    static TagLimiter
    create(int maxBytes, int maxLevels)
    Returns a new tag limiter with the given max bytes and nesting levels.
    int
    Returns the max number of bytes to be read before an exception is thrown when reading nbt.
    int
    Returns the max number of levels of nesting before an exception is thrown when reading nbt.
    static TagLimiter
    Returns a noop tag limiter.
    void
    Resets the current byte count.
  • Field Details

  • Method Details

    • create

      static TagLimiter create(int maxBytes, int maxLevels)
      Returns a new tag limiter with the given max bytes and nesting levels.
      Parameters:
      maxBytes - max amount of bytes to be read before an exception is thrown when reading nbt
      maxLevels - max levels of nesting before an exception is thrown when reading nbt
      Returns:
      tag limiter
    • noop

      static TagLimiter noop()
      Returns a noop tag limiter.
      Returns:
      noop tag limiter
    • countBytes

      void countBytes(int bytes)
      Counts the given number of bytes and throws an exception if the max bytes count is exceeded.
      Parameters:
      bytes - bytes to count
      Throws:
      IllegalArgumentException - if max bytes count is exceeded
    • checkLevel

      void checkLevel(int nestedLevel)
      Checks the current level of nesting and throws an exception if it exceeds the max levels.
      Parameters:
      nestedLevel - current level of nesting
      Throws:
      IllegalArgumentException - if max level count is exceeded
    • countByte

      default void countByte()
    • countShort

      default void countShort()
    • countInt

      default void countInt()
    • countFloat

      default void countFloat()
    • countLong

      default void countLong()
    • countDouble

      default void countDouble()
    • maxBytes

      int maxBytes()
      Returns the max number of bytes to be read before an exception is thrown when reading nbt.
      Returns:
      max bytes
    • maxLevels

      int maxLevels()
      Returns the max number of levels of nesting before an exception is thrown when reading nbt.
      Returns:
      max nesting levels
    • bytes

      int bytes()
      Returns the amount of currently read bytes.
      Returns:
      currently read bytes
    • reset

      void reset()
      Resets the current byte count.