package org.canova.image.loader;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.nd4j.linalg.api.buffer.BaseDataBuffer;
import org.nd4j.linalg.api.buffer.DataBuffer;
import java.lang.UnsupportedOperationException;

public class ImageByteBuffer extends BaseDataBuffer {

    public ImageByteBuffer(byte[] data, int length) {
        super(Unpooled.wrappedBuffer(data), length);
        this.elementSize = 1;
    }

    @Override
    protected DataBuffer create(int i) {
        throw new UnsupportedOperationException();
    }

    @Override
    public DataBuffer create(double[] doubles) {
        throw new UnsupportedOperationException();
    }

    @Override
    public DataBuffer create(float[] floats) {
        throw new UnsupportedOperationException();
    }

    @Override
    public DataBuffer create(int[] ints) {
        throw new UnsupportedOperationException();
    }

    @Override
    public DataBuffer create(ByteBuf byteBuf, int i) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int getElementSize() {
        return this.elementSize;
    }

    @Override
    public Type dataType() {
        return DataBuffer.Type.INT;
    }

    @Override
    public int getInt(int i) {
        return ((int)dataBuffer.getByte(i)) & 0xff;
    }

    @Override
    public float getFloat(int i) {
        return (float)getInt(i);
    }

    @Override
    public Number getNumber(int i) {
        return getInt(i);
    }

    @Override
    public double getDouble(int i) {
        return (double)getInt(i);
    }
}

@@ -191,56 +191,8 @@
 fer;
-%0Aimport java.lang.UnsupportedOperationException;
 %0A%0Apu
@@ -380,32 +380,402 @@
 ize = 1;%0A    %7D%0A%0A
+    public ImageByteBuffer(int i) %7B%0A        super(i);%0A    %7D%0A%0A    public ImageByteBuffer(double%5B%5D doubles) %7B%0A        super(doubles);%0A    %7D%0A%0A    public ImageByteBuffer(float%5B%5D floats) %7B%0A        super(floats);%0A    %7D%0A%0A    public ImageByteBuffer(int%5B%5D ints) %7B%0A        super(ints);%0A    %7D%0A%0A    public ImageByteBuffer(ByteBuf byteBuf, int i) %7B%0A        super(byteBuf, i);%0A    %7D%0A%0A
     @Override%0A  
@@ -825,48 +825,36 @@
     
-throw new UnsupportedOperationException(
+return new ImageByteBuffer(i
 );%0A 
@@ -934,48 +934,42 @@
     
-throw new UnsupportedOperationException(
+return new ImageByteBuffer(doubles
 );%0A 
@@ -1047,48 +1047,41 @@
     
-throw new UnsupportedOperationException(
+return new ImageByteBuffer(floats
 );%0A 
@@ -1155,48 +1155,39 @@
     
-throw new UnsupportedOperationException(
+return new ImageByteBuffer(ints
 );%0A 
@@ -1273,48 +1273,45 @@
     
-throw new UnsupportedOperationException(
+return new ImageByteBuffer(byteBuf, i
 );%0A 

Define factory methods for ImageByteBuffer correctly.