Home / File/ PooledHeapByteBuf.java — netty Source File

PooledHeapByteBuf.java — netty Source File

Architecture documentation for PooledHeapByteBuf.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to the License at:
 *
 *   https://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 io.netty.buffer;

import io.netty.util.Recycler;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty.util.internal.PlatformDependent;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;

class PooledHeapByteBuf extends PooledByteBuf<byte[]> {

    private static final Recycler<PooledHeapByteBuf> RECYCLER =
            new Recycler<PooledHeapByteBuf>() {
                @Override
                protected PooledHeapByteBuf newObject(Handle<PooledHeapByteBuf> handle) {
                    return new PooledHeapByteBuf(handle, 0);
                }
            };

    static PooledHeapByteBuf newInstance(int maxCapacity) {
        PooledHeapByteBuf buf = RECYCLER.get();
        buf.reuse(maxCapacity);
        return buf;
    }

    PooledHeapByteBuf(Handle<? extends PooledHeapByteBuf> recyclerHandle, int maxCapacity) {
        super(recyclerHandle, maxCapacity);
    }

    @Override
    public final boolean isDirect() {
        return false;
    }

    @Override
    protected byte _getByte(int index) {
        return HeapByteBufUtil.getByte(memory, idx(index));
    }

    @Override
    protected short _getShort(int index) {
        return HeapByteBufUtil.getShort(memory, idx(index));
    }

// ... (194 more lines)

Domain

Subdomains

Frequently Asked Questions

What does PooledHeapByteBuf.java do?
PooledHeapByteBuf.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is PooledHeapByteBuf.java in the architecture?
PooledHeapByteBuf.java is located at buffer/src/main/java/io/netty/buffer/PooledHeapByteBuf.java (domain: Buffer, subdomain: Allocators, directory: buffer/src/main/java/io/netty/buffer).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free