File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2000, 2018 IBM Corporation and others.
2+ * Copyright (c) 2000, 2025 IBM Corporation and others.
33 *
44 * This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License 2.0
2020import java .io .IOException ;
2121import java .io .InputStream ;
2222import java .io .InputStreamReader ;
23+ import java .util .stream .Collectors ;
2324
2425import org .eclipse .swt .SWT ;
2526import org .eclipse .swt .SWTError ;
@@ -118,17 +119,13 @@ void createExampleWidgets () {
118119 } else if (lastText != null ) {
119120 browser .setText (lastText );
120121 } else {
121- StringBuilder sb = new StringBuilder (300 );
122-
122+ String text = "" ;
123123 try (InputStream htmlStream = ControlExample .class .getResourceAsStream ("browser-content.html" );
124124 BufferedReader br = new BufferedReader (new InputStreamReader (htmlStream ))) {
125- int read = 0 ;
126- while ((read = br .read ()) != -1 )
127- sb .append ((char ) read );
125+ text = br .lines ().collect (Collectors .joining ("\n " ));
128126 } catch (IOException e ) {
129127 log (e .getMessage ());
130128 }
131- String text = sb .toString ();
132129 browser .setText (text );
133130 }
134131 lastText = lastUrl = null ;
You can’t perform that action at this time.
0 commit comments