加载着色器的异常

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;
		
		
	}
如果红色部分被屏蔽后,会导致加载着色器不成功!

你可能感兴趣的:(加载着色器的异常)