File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
src/java.base/share/classes/java/io Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1030,17 +1030,32 @@ public final double readDouble() throws IOException {
10301030 */
10311031
10321032 public final String readLine () throws IOException {
1033+ if (jfrTracing && FileReadEvent .enabled ()) {
1034+ long bytesRead = 0 ;
1035+ long start = FileReadEvent .timestamp ();
1036+ try {
1037+ String result = implReadLine ();
1038+ bytesRead = result == null ? 0 : result .length ();
1039+ return result ;
1040+ } finally {
1041+ FileReadEvent .offer (start , path , bytesRead );
1042+ }
1043+ }
1044+ return implReadLine ();
1045+ }
1046+
1047+ private final String implReadLine () throws IOException {
10331048 StringBuilder input = new StringBuilder ();
10341049 int c = -1 ;
10351050 boolean eol = false ;
10361051
10371052 while (!eol ) {
1038- switch (c = read ()) {
1053+ switch (c = read0 ()) {
10391054 case -1 , '\n' -> eol = true ;
10401055 case '\r' -> {
10411056 eol = true ;
10421057 long cur = getFilePointer ();
1043- if ((read ()) != '\n' ) {
1058+ if ((read0 ()) != '\n' ) {
10441059 seek (cur );
10451060 }
10461061 }
You can’t perform that action at this time.
0 commit comments