public static ResourceEntity readResValue(ByteBuffer buffer,StringPool stringPool){
  ResValue resValue=new ResValue();
  resValue.setSize(Buffers.readUShort(buffer));
  resValue.setRes0(Buffers.readUByte(buffer));
  resValue.setDataType(Buffers.readUByte(buffer));
switch (resValue.getDataType()) {
case ResValue.ResType.INT_DEC:
case ResValue.ResType.INT_HEX:
    resValue.setData(new ResourceEntity(buffer.getInt()));
  break;
case ResValue.ResType.STRING:
int strRef=buffer.getInt();
if (strRef >= 0) {
resValue.setData(new ResourceEntity(stringPool.get(strRef)));
}
break;
case ResValue.ResType.REFERENCE:
long resourceId=Buffers.readUInt(buffer);
resValue.setData(new ResourceEntity(resourceId));
break;
case ResValue.ResType.INT_BOOLEAN:
resValue.setData(new ResourceEntity(buffer.getInt() != 0));
break;
case ResValue.ResType.NULL:
resValue.setData(new ResourceEntity(""));
break;
case ResValue.ResType.INT_COLOR_RGB8:
case ResValue.ResType.INT_COLOR_RGB4:
resValue.setData(new ResourceEntity(readRGBs(buffer,6)));
break;
case ResValue.ResType.INT_COLOR_ARGB8:
case ResValue.ResType.INT_COLOR_ARGB4:
resValue.setData(new ResourceEntity(readRGBs(buffer,8)));
break;
case ResValue.ResType.DIMENSION:
resValue.setData(new ResourceEntity(getDimension(buffer)));
break;
case ResValue.ResType.FRACTION:
resValue.setData(new ResourceEntity(getFraction(buffer)));
break;
default :
resValue.setData(new ResourceEntity("{" + resValue.getDataType() + ":"+ Buffers.readUInt(buffer)+ "}"));
}
return resValue.getData();
}

public static ResourceEntity readResValue ( ByteBuffer buffer , StringPool stringPool ) { ResValue resValue = new ResValue ( ) ; resValue . setSize ( Buffers . readUShort ( buffer ) ) ; resValue . setRes0 ( Buffers . readUByte ( buffer ) ) ; resValue . setDataType ( Buffers . readUByte ( buffer ) ) ; switch ( resValue . getDataType ( ) ) { case ResValue . ResType . INT_DEC : case ResValue . ResType . INT_HEX : resValue . setData ( new ResourceEntity ( buffer . getInt ( ) ) ) ; break ; case ResValue . ResType . STRING : int strRef = buffer . getInt ( ) ; if ( strRef >= 0 ) { resValue . setData ( new ResourceEntity ( stringPool . get ( strRef ) ) ) ; } break ; case ResValue . ResType . REFERENCE : long resourceId = Buffers . readUInt ( buffer ) ; resValue . setData ( new ResourceEntity ( resourceId ) ) ; break ; case ResValue . ResType . INT_BOOLEAN : resValue . setData ( new ResourceEntity ( buffer . getInt ( ) != 0 ) ) ; break ; case ResValue . ResType . NULL : resValue . setData ( new ResourceEntity ( "" ) ) ; break ; case ResValue . ResType . INT_COLOR_RGB8 : case ResValue . ResType . INT_COLOR_RGB4 : resValue . setData ( new ResourceEntity ( readRGBs ( buffer , 6 ) ) ) ; break ; case ResValue . ResType . INT_COLOR_ARGB8 : case ResValue . ResType . INT_COLOR_ARGB4 : resValue . setData ( new ResourceEntity ( readRGBs ( buffer , 8 ) ) ) ; break ; case ResValue . ResType . DIMENSION : resValue . setData ( new ResourceEntity ( getDimension ( buffer ) ) ) ; break ; case ResValue . ResType . FRACTION : resValue . setData ( new ResourceEntity ( getFraction ( buffer ) ) ) ; break ; default : resValue . setData ( new ResourceEntity ( "{" + resValue . getDataType ( ) + ":" + Buffers . readUInt ( buffer ) + "}" ) ) ; } return resValue . getData ( ) ; }
read res value , convert from different types to string .
