JAVA - 当找到&符号时,读取InputStream会停止

时间:2015-10-15 10:32:37

标签: java android byte inputstream

我正在使用简单的输入/输出流

从URL读取HTML源代码
URL website = new URL(url);
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = context.openFileOutput("pagina.html", 0);
fos.getChannel().transferFrom(rbc, 0, 2000000);
fos.close();

尝试阅读我下载的内容时

BufferedReader br = new BufferedReader(new InputStreamReader(context.openFileInput("pagina.html")));
String line;
String content="";
while((line=br.readLine())!=null)
   content += linea;

当“&&”时停止找到了。 原始内容(使用Chrome的代码查看器)是:

function addFav() {if (navigator.platform.substring(0,3) == 'Win' && navigator.appName.substring(0,3)=='Mic') {
    document.write('<a href="javascript:void(0)" title="Añadir esta página a Favoritos" onClick="window.external.AddFavorite(location.href,document.title);" class="aTxtPortail">Añadir a Favoritos<\/a>');
} else if (window.sidebar&&window.sidebar.addPanel){
    document.write('<a href="javascript:void(0)" title="Añadir esta página a Favoritos" onClick="window.sidebar.addPanel(document.title,location.href,\'\');" class="aTxtPortail">Añadir a Favoritos<\/a>')
}
}

但是,引用的代码结束于:

function addFav(){if (navigator.platform.substring(0,3) == 'Win' ?????????????????????????????????????????????????????????????????????????????

读取字节缓冲区时是否考虑使用&符号?感谢。

0 个答案:

没有答案