Skip to content

Commit a25b144

Browse files
author
Gary Gregory
committed
Formatting.
1 parent b47686a commit a25b144

1 file changed

Lines changed: 20 additions & 21 deletions

File tree

src/main/java/org/apache/commons/io/input/Tailer.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ public void run() {
441441
// Finish scanning the old file and then we'll start with the new one
442442
try {
443443
readLines(save);
444-
} catch (final IOException ioe) {
444+
} catch (final IOException ioe) {
445445
listener.handle(ioe);
446446
}
447447
position = 0;
@@ -489,8 +489,7 @@ public void run() {
489489
if (reader != null) {
490490
reader.close();
491491
}
492-
}
493-
catch (final IOException e) {
492+
} catch (final IOException e) {
494493
listener.handle(e);
495494
}
496495
stop();
@@ -520,27 +519,27 @@ private long readLines(final RandomAccessFile reader) throws IOException {
520519
while (getRun() && ((num = reader.read(inbuf)) != EOF)) {
521520
for (int i = 0; i < num; i++) {
522521
final byte ch = inbuf[i];
523-
switch ( ch ) {
524-
case '\n':
525-
seenCR = false; // swallow CR before LF
522+
switch (ch) {
523+
case '\n':
524+
seenCR = false; // swallow CR before LF
525+
listener.handle(new String(lineBuf.toByteArray(), charset));
526+
lineBuf.reset();
527+
rePos = pos + i + 1;
528+
break;
529+
case '\r':
530+
if (seenCR) {
531+
lineBuf.write('\r');
532+
}
533+
seenCR = true;
534+
break;
535+
default:
536+
if (seenCR) {
537+
seenCR = false; // swallow final CR
526538
listener.handle(new String(lineBuf.toByteArray(), charset));
527539
lineBuf.reset();
528540
rePos = pos + i + 1;
529-
break;
530-
case '\r':
531-
if (seenCR) {
532-
lineBuf.write('\r');
533-
}
534-
seenCR = true;
535-
break;
536-
default:
537-
if (seenCR) {
538-
seenCR = false; // swallow final CR
539-
listener.handle(new String(lineBuf.toByteArray(), charset));
540-
lineBuf.reset();
541-
rePos = pos + i + 1;
542-
}
543-
lineBuf.write(ch);
541+
}
542+
lineBuf.write(ch);
544543
}
545544
}
546545
pos = reader.getFilePointer();

0 commit comments

Comments
 (0)