Skip to content

Commit 85e9334

Browse files
committed
DataHandle: add writeLine(String) method
This is analogous to readLine().
1 parent b2ca192 commit 85e9334

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/org/scijava/io/DataHandle.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.io.EOFException;
3939
import java.io.IOException;
4040
import java.io.InputStreamReader;
41+
import java.io.UTFDataFormatException;
4142
import java.nio.ByteBuffer;
4243
import java.nio.ByteOrder;
4344

@@ -410,6 +411,17 @@ default String findString(final boolean saveString, final int blockSize,
410411
return saveString ? out.toString() : null;
411412
}
412413

414+
/**
415+
* Writes the provided string, followed by a newline character.
416+
*
417+
* @param string The string to write.
418+
* @throws IOException If an I/O error occurs.
419+
*/
420+
default void writeLine(final String string) throws IOException {
421+
writeBytes(string);
422+
writeBytes("\n");
423+
}
424+
413425
// -- InputStream look-alikes --
414426

415427
/**

0 commit comments

Comments
 (0)