java.lang.Object
io.github.astrapi69.file.write.StoreFileExtensions
The class
StoreFileExtensions
provides extension methods for files to store or update-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Stores the given byte array to the givenFile
objectstatic boolean
static boolean
static boolean
-
Method Details
-
toFile
Stores the given byte array to the givenFile
object- Parameters:
file
- TheFile
object to write the given byte arraydata
- The byte array to be store- Throws:
IOException
- Signals that an I/O exception has occurred
-
toFile
public static boolean toFile(File file, String stringToWrite) throws FileNotFoundException, IOException - Parameters:
file
- TheFile
object to write the givenString
objectstringToWrite
- TheString
object to write into the givenFile
object- Returns:
- true if given
String
object was written successfully to the givenFile
object otherwise false - Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failedIOException
- Signals that an I/O exception has occurred
-
toFile
public static boolean toFile(File file, String stringToWrite, String encoding) throws FileNotFoundException, IOException This Method writes the givenString
object to the givenFile
object with the given encoding asString
object- Parameters:
file
- TheFile
object to write the givenString
objectstringToWrite
- TheString
object to write into the givenFile
objectencoding
- The encoding from the file asString
object- Returns:
- true if given
String
object was written successfully to the givenFile
object otherwise false - Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failedIOException
- Signals that an I/O exception has occurred
-
toFile
public static boolean toFile(File file, String stringToWrite, Charset charset) throws FileNotFoundException, IOException This Method writes the givenString
object to the givenFile
object with the encoding that is encapsulated in the givenCharset
object- Parameters:
file
- TheFile
object to write the givenString
objectstringToWrite
- TheString
object to write into the givenFile
objectcharset
- The charset from the file.- Returns:
- true if given
String
object was written successfully to the givenFile
object otherwise false - Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failedIOException
- Signals that an I/O exception has occurred
-