if (encoding != null && encoding.equalsIgnoreCase("base64")) {
if (encoding != null && "base64".equalsIgnoreCase(encoding)) {
    private MapLayer readLayer(Node t) throws Exception {        int layerWidth = getAttribute(t, "width", map.getWidth());        int layerHeight = getAttribute(t, "height", map.getHeight());        TileLayer ml = new TileLayer(layerWidth, layerHeight);        int offsetX = getAttribute(t, "x", 0);        int offsetY = getAttribute(t, "y", 0);        int visible = getAttribute(t, "visible", 1);        String opacity = getAttributeValue(t, "opacity");        ml.setOffset(offsetX, offsetY);        ml.setName(getAttributeValue(t, "name"));        ml.setVisible(visible == 1);        if (opacity != null) {            ml.setOpacity(Float.parseFloat(opacity));        }        Properties mlProps = ml.getProperties();        for (Node child = t.getFirstChild(); child != null;                child = child.getNextSibling())        {            if (child.getNodeName().equalsIgnoreCase("data")) {                String encoding = getAttributeValue(child, "encoding");                if (encoding != null && encoding.equalsIgnoreCase("base64")) {                    Node cdata = child.getFirstChild();                    if (cdata == null) {                    	logger.warn("layer <data> tag enclosed no data. (empty data tag)");                    } else {                        char[] enc = cdata.getNodeValue().trim().toCharArray();                        byte[] dec = Base64.decode(enc);                        ByteArrayInputStream bais = new ByteArrayInputStream(dec);                        InputStream is;                        String comp = getAttributeValue(child, "compression");                        if (comp != null && comp.equalsIgnoreCase("gzip")) {                            is = new GZIPInputStream(bais);                        } else {                            is = bais;                        }                        for (int y = 0; y < ml.getHeight(); y++) {                            for (int x = 0; x < ml.getWidth(); x++) {                                int tileId = 0;                                tileId |= is.read();                                tileId |= is.read() <<  8;                                tileId |= is.read() << 16;                                tileId |= is.read() << 24;                                TileSet ts = map.findTileSetForTileGID(tileId);                                if (ts != null) {                                    ml.setTileAt(x, y,                                            ts.getTile(tileId - ts.getFirstGid()));                                } else {                                    ml.setTileAt(x, y, null);                                }                            }                        }                    }                } else {                    int x = 0, y = 0;                    for (Node dataChild = child.getFirstChild();                            dataChild != null;                            dataChild = dataChild.getNextSibling())                    {                        if (dataChild.getNodeName().equalsIgnoreCase("tile")) {                            int tileId = getAttribute(dataChild, "gid", -1);                            TileSet ts = map.findTileSetForTileGID(tileId);                            if (ts != null) {                                ml.setTileAt(x, y,                                        ts.getTile(tileId - ts.getFirstGid()));                            } else {                                ml.setTileAt(x, y, null);                            }                            x++;                            if (x == ml.getWidth()) {                                x = 0; y++;                            }                            if (y == ml.getHeight()) { break; }                        }                    }                }            } else if (child.getNodeName().equalsIgnoreCase("property")) {                mlProps.setProperty(getAttributeValue(child, "name"),                        getAttributeValue(child, "value"));            }        }        return ml;    }