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

package io.netty.channel.nio;

import java.nio.channels.SelectionKey;
import io.netty.channel.IoEvent;
import io.netty.channel.IoRegistration;
import io.netty.util.internal.ObjectUtil;
import io.netty.channel.IoHandle;
import java.nio.channels.SelectableChannel;

public abstract class NioSelectableChannelIoHandle<S extends SelectableChannel> implements IoHandle, NioIoHandle
{
    private final S channel;
    
    public NioSelectableChannelIoHandle(final S channel) {
        this.channel = ObjectUtil.checkNotNull(channel, "channel");
    }
    
    @Override
    public void handle(final IoRegistration registration, final IoEvent ioEvent) {
        final SelectionKey key = registration.attachment();
        this.handle(this.channel, key);
    }
    
    @Override
    public void close() throws Exception {
        this.channel.close();
    }
    
    @Override
    public SelectableChannel selectableChannel() {
        return this.channel;
    }
    
    protected abstract void handle(final S p0, final SelectionKey p1);
    
    protected void deregister(final S channel) {
    }
}
