日期:2014-05-20 浏览次数:20830 次
InputStream is = getClass().getResourceAsStream("/city.xml"); int length = 0; try { while (is.read() != -1) { length++; } // byte[] info = new byte[592892]; byte[] info = new byte[length]; is.read(info); System.out.println(new String(info)); } catch (IOException e) { e.printStackTrace(); }
InputStream is = getClass().getResourceAsStream("/city.xml"); try { byte[] info = new byte[is.available()]; is.read(info, 0, is.available()); System.out.println(new String(info, "GB2312")); } catch (IOException e) { }