public class FileSystemUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
readLines(FileSystem filesystem,
java.lang.String file)
Reads a text file fully into memory and splits the lines.
|
static java.lang.String[] |
readLines(FileSystem filesystem,
java.lang.String file,
java.lang.String[] defaultReturn)
Reads a text file fully into memory and splits the lines.
|
static byte[] |
readWhole(FileSystem filesystem,
java.lang.String file)
Reads a binary file fully into memory.
|
static java.lang.String |
readWholeText(FileSystem filesystem,
java.lang.String file)
Reads a text file fully into memory.
|
static boolean |
simpleByteArrayCompare(byte[] byt1,
byte[] byt2)
Performs a byte array comparison.
|
static void |
writeLines(FileSystem filesystem,
java.lang.String file,
java.lang.String[] content)
Writes the lines into a text file.
|
static void |
writeWhole(FileSystem filesystem,
java.lang.String file,
byte[] content)
Writes the content into a file.
|
static void |
writeWholeText(FileSystem filesystem,
java.lang.String file,
java.lang.String content)
Writes the text into a text file.
|
public static boolean simpleByteArrayCompare(byte[] byt1, byte[] byt2)
byt1
- the first byte arraybyt2
- the second byte arraypublic static java.lang.String[] readLines(FileSystem filesystem, java.lang.String file, java.lang.String[] defaultReturn)
filesystem
- the file systemfile
- the filedefaultReturn
- the default return valuepublic static java.lang.String[] readLines(FileSystem filesystem, java.lang.String file) throws PathNotFoundException, AccessDeniedException, NotAFileException
filesystem
- the file systemfile
- the filePathNotFoundException
- the path was not foundAccessDeniedException
- the access is deniedNotAFileException
- the given path is not a filepublic static java.lang.String readWholeText(FileSystem filesystem, java.lang.String file) throws PathNotFoundException, AccessDeniedException, NotAFileException
filesystem
- the file systemfile
- the filePathNotFoundException
- the path was not foundAccessDeniedException
- the access is deniedNotAFileException
- the given path is not a filepublic static byte[] readWhole(FileSystem filesystem, java.lang.String file) throws PathNotFoundException, AccessDeniedException, NotAFileException
filesystem
- the file systemfile
- the filePathNotFoundException
- the path was not foundAccessDeniedException
- the access is deniedNotAFileException
- the given path is not a filepublic static void writeLines(FileSystem filesystem, java.lang.String file, java.lang.String[] content) throws PathNotFoundException, AccessDeniedException, NotAFileException, DriveFullException
filesystem
- the file systemfile
- the filecontent
- the content (lines)PathNotFoundException
- the path was not foundAccessDeniedException
- the access is deniedNotAFileException
- the given path is not a fileDriveFullException
- there is no more spacepublic static void writeWholeText(FileSystem filesystem, java.lang.String file, java.lang.String content) throws PathNotFoundException, AccessDeniedException, NotAFileException, DriveFullException
filesystem
- the file systemfile
- the filecontent
- the contentPathNotFoundException
- the path was not foundAccessDeniedException
- the access is deniedNotAFileException
- the given path is not a fileDriveFullException
- there is no more spacepublic static void writeWhole(FileSystem filesystem, java.lang.String file, byte[] content) throws PathNotFoundException, AccessDeniedException, NotAFileException, DriveFullException
filesystem
- the file systemfile
- the filecontent
- the contentPathNotFoundException
- the path was not foundAccessDeniedException
- the access is deniedNotAFileException
- the given path is not a fileDriveFullException
- there is no more space