Added writeBytesToFile method.
This commit is contained in:
parent
23c621784c
commit
de18e4bd9f
|
|
@ -41,4 +41,22 @@ public class FileOperations {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean writeBytesToFile(String filePath, byte[] bytes) {
|
||||
File file = new File(filePath);
|
||||
if (!file.canWrite()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
FileOutputStream fileStream = new FileOutputStream(file);
|
||||
fileStream.write(bytes);
|
||||
} catch (FileNotFoundException ex) {
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue