Read a file's content from the expression of a conditional JAVA breakpoint in Eclipse without creating variables -


how read content of file expression of conditional java breakpoint in eclipse?

my breakpoint's condition true when value of string variable contains 'earnings':

myvariable != null && myvariable.contains("earnings")

i want conditional breakpoint replace content of string when true; however, have been able waiting jvm break (at breakpoint) , having following block displayed (ctrl+shift+d). block reads content of file myvariable.

string scurrentline, filename = "modified-earnings.xml";  java.lang.stringbuffer sb = new java.lang.stringbuffer(); java.io.filereader fr = new java.io.filereader(filename);  java.io.bufferedreader br = new java.io.bufferedreader(fr); while ((scurrentline = br.readline()) != null) {     sb.append(scurrentline + system.getproperty("line.separator")); } fr.close(); // variable gets new value file myvariable = sb.tostring(); br.close(); 

as see, having evaluate lines every time want replace value of string little bit of hassle, want debugger me, using same conditional nature of breakpoint. note additional (last) boolean expression (myvariable = magiccode("modified-earnings.xml")) != null

myvariable != null && myvariable.contains("earnings") && (myvariable = magiccode("modified-earnings.xml")) != null

what i'm missing magiccode function can not code, since can not (repeat can not) change code or add new jars classpath. ideally, system api it:

myvariable = streamtostring.do(system.getresourceasstream("modified-earnings.xml")) 

for java 8,
eclipse breakpoint conditional code checks content hello in file c:/temp/hello.txt.

"hello".equals(new string(java.nio.file.files.readallbytes(java.nio.file.paths.get("c:/temp/hello.txt")))) 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -