All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.joekerouac.common.tools.io.ByteBufferRef Maven / Gradle / Ivy

The newest version!
// Generated by delombok at Fri Mar 14 11:41:38 CST 2025
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
 * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
 * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package com.github.joekerouac.common.tools.io;

/**
 * byte buffer引用
 *
 * @author JoeKerouac
 * @date 2023-06-08 10:16
 * @since 2.0.3
 */
public class ByteBufferRef {
    public static final ByteBufferRef EMPTY = new ByteBufferRef(new byte[0], 0, 0);
    private byte[] data;
    /**
     * data中的可用数据起始位置
     */
    private int offset;
    /**
     * data中的可用数据长度
     */
    private int len;

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public byte[] getData() {
        return this.data;
    }

    /**
     * data中的可用数据起始位置
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getOffset() {
        return this.offset;
    }

    /**
     * data中的可用数据长度
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getLen() {
        return this.len;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setData(final byte[] data) {
        this.data = data;
    }

    /**
     * data中的可用数据起始位置
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setOffset(final int offset) {
        this.offset = offset;
    }

    /**
     * data中的可用数据长度
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setLen(final int len) {
        this.len = len;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof ByteBufferRef)) return false;
        final ByteBufferRef other = (ByteBufferRef) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        if (this.getOffset() != other.getOffset()) return false;
        if (this.getLen() != other.getLen()) return false;
        if (!java.util.Arrays.equals(this.getData(), other.getData())) return false;
        return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
        return other instanceof ByteBufferRef;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        result = result * PRIME + this.getOffset();
        result = result * PRIME + this.getLen();
        result = result * PRIME + java.util.Arrays.hashCode(this.getData());
        return result;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "ByteBufferRef(data=" + java.util.Arrays.toString(this.getData()) + ", offset=" + this.getOffset() + ", len=" + this.getLen() + ")";
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public ByteBufferRef(final byte[] data, final int offset, final int len) {
        this.data = data;
        this.offset = offset;
        this.len = len;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public ByteBufferRef() {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy