private PixelReader parseMetaData(int bytesOfKeyValueData, DataInput in) throws IOException {
        PixelReader pixelReader = null;
        for (int i = 0; i < bytesOfKeyValueData;) {
            //reading key values
            int keyAndValueByteSize = in.readInt();            
            byte[] keyValue = new byte[keyAndValueByteSize];
            in.readFully(keyValue);
            
            
            //parsing key values
            String[] kv = new String(keyValue).split("\0");            
            for (int j = 0; j < kv.length; j += 2) {
                System.err.println("key : " + kv[j]);
                System.err.println("value : " + kv[j + 1]);
                if(kv[j].equalsIgnoreCase("KTXorientation")){
                    if(kv[j + 1].startsWith("S=r,T=d") ){
                        pixelReader = new SrTdRiPixelReader();
                    }else{
                        pixelReader = new SrTuRoPixelReader();
                    }
                    if(kv[j + 1].contains("R=i")){
                        slicesInside = true;
                    }
                }
            }
            
            //padding
            int padding = 3 - ((keyAndValueByteSize + 3) % 4);            
            if (padding > 0) {
                in.skipBytes(padding);
            }
            i += 4 + keyAndValueByteSize + padding;
        }
        return pixelReader;
    }
Parse the file metaData to select the PixelReader that suits the file 
coordinates orientation

@param bytesOfKeyValueData number of bytes to read
@param in the input stream (not null)
@return a new instance or null
@throws IOException from the input stream
jme3-core/src/plugins/java/com/jme3/texture/plugins/ktx/KTXLoader.java