Record Class MemorySegmentFreeDrop

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.network.netty.memory.MemorySegmentFreeDrop
Record Components:
segment - the segment to free when dropping.
byteSize - the size of the given memory segment.
All Implemented Interfaces:
io.netty5.buffer.Drop<io.netty5.buffer.Buffer>

record MemorySegmentFreeDrop(@NonNull MemorySegment segment, long byteSize) extends Record implements io.netty5.buffer.Drop<io.netty5.buffer.Buffer>
Drop that frees the given memory segment when dropped.
Since:
4.0
  • Field Details

  • Constructor Details

    • MemorySegmentFreeDrop

      public MemorySegmentFreeDrop(@NonNull @NonNull MemorySegment segment, long byteSize)
      Creates an instance of a MemorySegmentFreeDrop record class.
      Parameters:
      segment - the value for the segment record component
      byteSize - the value for the byteSize record component
    • MemorySegmentFreeDrop

      public MemorySegmentFreeDrop(@NonNull @NonNull MemorySegment segment)
      Constructs a new instance using the byte size of the given memory segment.
      Parameters:
      segment - the segment to free when dropping.
      Throws:
      NullPointerException - if the given segment is null.
  • Method Details

    • drop

      public void drop(@NonNull @NonNull io.netty5.buffer.Buffer obj)
      Specified by:
      drop in interface io.netty5.buffer.Drop<io.netty5.buffer.Buffer>
    • fork

      @NonNull public @NonNull io.netty5.buffer.Drop<io.netty5.buffer.Buffer> fork()
      Specified by:
      fork in interface io.netty5.buffer.Drop<io.netty5.buffer.Buffer>
    • attach

      public void attach(@NonNull @NonNull io.netty5.buffer.Buffer obj)
      Specified by:
      attach in interface io.netty5.buffer.Drop<io.netty5.buffer.Buffer>
    • toString

      @NonNull public @NonNull String toString()
      Specified by:
      toString in class Record
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • segment

      @NonNull public @NonNull MemorySegment segment()
      Returns the value of the segment record component.
      Returns:
      the value of the segment record component
    • byteSize

      public long byteSize()
      Returns the value of the byteSize record component.
      Returns:
      the value of the byteSize record component