I'm reading a HTML source from URL using simple Input/Output Stream
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();
When trying to read what i've downloaded
BufferedReader br = new BufferedReader(new InputStreamReader(context.openFileInput("pagina.html")));
String line;
String content="";
while((line=br.readLine())!=null)
content += linea;
It stops when a "&&" is found. Original content (using Chrome's code viewer) is:
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>')
}
}
But readed code ends on:
function addFav(){if (navigator.platform.substring(0,3) == 'Win' ?????????????????????????????????????????????????????????????????????????????
Is there any consideration with the ampersand character when reading byte buffers? Thanks.