首页 > 其他 > 详细

载入着色器的异常

时间:2017-07-24 18:35:21      阅读:375      评论:0      收藏:0      [点我收藏+]
public static String loadFromAssetsFile(String fname, Resources r) {
		String result = null;
		
		
		try {
			InputStream in = r.getAssets().open(fname);
			int ch = 0;
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			<span style="background-color: rgb(255, 0, 0);">while ((ch = in.read()) != -1) {//-1表示着色内容的最后一行
				baos.write(ch);
			}</span>
			System.out.println(ch);
			byte[] buff = baos.toByteArray();
			baos.close();
			in.close();
			result = new String(buff, "UTF-8");
			result = result.replaceAll("\\r\\n", "\n");
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
		
		
	}
假设红色部分被屏蔽后,会导致载入着色器不成功。

载入着色器的异常

原文:http://www.cnblogs.com/wzzkaifa/p/7230249.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!