// 
// Decompiled by Procyon v0.6.0
// 

package io.netty.buffer;

import java.nio.ByteBuffer;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.CleanableDirectBuffer;

class UnpooledUnsafeNoCleanerDirectByteBuf extends UnpooledUnsafeDirectByteBuf
{
    UnpooledUnsafeNoCleanerDirectByteBuf(final ByteBufAllocator alloc, final int initialCapacity, final int maxCapacity, final boolean allowSectionedInternalNioBufferAccess) {
        super(alloc, initialCapacity, maxCapacity, allowSectionedInternalNioBufferAccess);
    }
    
    @Override
    protected CleanableDirectBuffer allocateDirectBuffer(final int capacity) {
        return PlatformDependent.allocateDirectBufferNoCleaner(capacity);
    }
    
    @Override
    protected ByteBuffer allocateDirect(final int initialCapacity) {
        throw new UnsupportedOperationException();
    }
    
    CleanableDirectBuffer reallocateDirect(final CleanableDirectBuffer oldBuffer, final int initialCapacity) {
        return PlatformDependent.reallocateDirectBufferNoCleaner(oldBuffer, initialCapacity);
    }
    
    @Override
    protected void freeDirect(final ByteBuffer buffer) {
        throw new UnsupportedOperationException();
    }
    
    @Override
    public ByteBuf capacity(final int newCapacity) {
        this.checkNewCapacity(newCapacity);
        final int oldCapacity = this.capacity();
        if (newCapacity == oldCapacity) {
            return this;
        }
        this.trimIndicesToCapacity(newCapacity);
        this.setByteBuffer(this.reallocateDirect(this.cleanable, newCapacity), false);
        return this;
    }
}
