public class FileLineSupplier extends java.lang.Object implements ResettableSupplier<java.lang.String>, java.io.Closeable
ResettableSupplier
if you pass in a reader directly instead of a file, the reset call will failConstructor and Description |
---|
FileLineSupplier(java.io.BufferedReader reader)
Create a supplier by passing a reader directly.
|
FileLineSupplier(java.io.File file)
Create a supplier by passing a file
|
FileLineSupplier(java.io.File file,
java.nio.charset.Charset charset)
Create a supplier by passing a file
|
FileLineSupplier(java.nio.file.Path path)
Create a supplier by passing a file
|
FileLineSupplier(java.nio.file.Path path,
java.nio.charset.Charset charset)
Create a supplier by passing a file
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
equals(java.lang.Object o) |
java.lang.String |
get() |
int |
hashCode() |
void |
reset()
Resets the state of this supplier so that the next call to
get() returns as if it were the first time the method were called |
java.lang.String |
toString() |
public FileLineSupplier(@NotNull java.io.File file) throws java.io.IOException
file
- The file to read using the system default character setjava.io.IOException
- On error opening the file for readpublic FileLineSupplier(@NotNull java.io.File file, @NotNull java.nio.charset.Charset charset) throws java.io.IOException
file
- The file to readcharset
- The character set used for reading the filejava.io.IOException
- On error opening the file for readpublic FileLineSupplier(@NotNull java.nio.file.Path path) throws java.io.IOException
path
- The file to read as a path using the system default character setjava.io.IOException
- On error opening the file for readpublic FileLineSupplier(@NotNull java.nio.file.Path path, @NotNull java.nio.charset.Charset charset) throws java.io.IOException
path
- The file to read as a pathcharset
- The character set used for reading the filejava.io.IOException
- On error opening the file for readpublic FileLineSupplier(@NotNull java.io.BufferedReader reader)
reader
- A reader to read frompublic void reset()
ResettableSupplier
get()
returns as if it were the first time the method were calledreset
in interface ResettableSupplier<java.lang.String>
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
@Nullable public java.lang.String get()
get
in interface java.util.function.Supplier<java.lang.String>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object