Back to project page android-shape-imageview.
The source code is released under:
Apache License
If you think the Android project android-shape-imageview listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.siyamed.shapeimageview.path; // ww w .j a v a 2 s . c o m import android.content.Context; import com.github.siyamed.shapeimageview.path.parser.IoUtil; import com.github.siyamed.shapeimageview.path.parser.PathInfo; import com.github.siyamed.shapeimageview.path.parser.SvgToPath; import java.io.InputStream; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class SvgUtil { private static final Map<Integer, PathInfo> PATH_MAP = new ConcurrentHashMap<Integer, PathInfo>(); public static final PathInfo readSvg(Context context, int resId) { PathInfo pathInfo = PATH_MAP.get(resId); if(pathInfo == null) { InputStream is = null; try { is = context.getResources().openRawResource(resId); pathInfo = SvgToPath.getSVGFromInputStream(is); PATH_MAP.put(resId, pathInfo); } finally { IoUtil.closeQuitely(is); } } return pathInfo; } }