public class FileUtils extends Object
Modifier and Type | Method and Description |
---|---|
static long |
countLines(File file)
Counts the number of lines in the file.
|
static long |
getChecksumValue(String path)
Checksum using java.util.zip.
|
static String |
read(File file,
long startOffset,
long numBytes) |
static byte[] |
readBytes(File file,
int start,
int numBytes) |
static List |
readLines(File file,
long firstLine,
long numLines,
boolean includeEmptyLines) |
static List |
readLinesFromEnd(File file,
long numLines,
boolean includeEmptyLines) |
static List |
readLinesFromStart(File file,
long numLines,
boolean includeEmptyLines) |
static void |
sync(File file) |
static void |
writeBinary(File file,
List content,
boolean append,
String mode) |
static void |
writeBytes(File file,
byte[] bytes,
boolean append) |
static void |
writeLines(File file,
List lines,
boolean append) |
static void |
writeLines(File file,
List lines,
boolean append,
boolean includeEmpty) |
static void |
writeLines(File file,
String[] lines,
boolean append,
boolean includeEmpty) |
public static long countLines(File file) throws Exception
file
- to read.Exception
public static long getChecksumValue(String path) throws IOException
IOException
public static String read(File file, long startOffset, long numBytes) throws Exception
Exception
public static byte[] readBytes(File file, int start, int numBytes) throws Exception
Exception
public static List readLines(File file, long firstLine, long numLines, boolean includeEmptyLines) throws Exception
Exception
public static List readLinesFromEnd(File file, long numLines, boolean includeEmptyLines) throws Exception
Exception
public static List readLinesFromStart(File file, long numLines, boolean includeEmptyLines) throws Exception
Exception
public static void writeBinary(File file, List content, boolean append, String mode) throws Exception
Exception
public static void writeBytes(File file, byte[] bytes, boolean append) throws Exception
Exception
public static void writeLines(File file, List lines, boolean append) throws Exception
Exception
public static void writeLines(File file, List lines, boolean append, boolean includeEmpty) throws Exception
Exception
Copyright © 2022. All rights reserved.