Home > Contents > Index >
Utilities.writeFile
Writes a file to disk, given a path and the contents of the file.
The contents are in a byte array. The path is internally converted by
osSafeSpec()
. This method has two variants:
- writeFile (Variant 1) accepts a string.
- writeFile (Variant 2) accepts an array of bytes.
Utilities.writeFile
Writes a file to disk, given a pathname and the contents of the file.
Syntax
public static final boolean writeFile(String fname, String str)Parameters
fname
- The pathname of the target file.
str
- The data to write to the file.
Returns
Returns
true
on success,false
on failure.Description
Writes a file to disk, given a path and the contents of the file. The path is internally converted by
osSafeSpec()
.See Also
osSafeSpec()
Utilities.writeFile
Writes a file to disk, given a pathname, the contents of the file, and the number of bytes to write.
Syntax
public static final boolean writeFile(String fname, byte[] bytes, int len)Parameters
fname
- The pathname of the target file.
bytes
- The byte array to write to the file.
len
- The number of bytes to write to the file.
Description
The
writeFile
method writes a file to disk, given a path and the contents of the file. The contents are in a byte array. The writeFile method writes up tolen
bytes of the input byte array. The path is internally converted by osSafeSpec .Returns
Returns
true
on success,false
on failure.See Also
Home > Contents > Index > ![]()
Oracle JAVA Reference
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.