When you are storing a text in a file and keep on adding to it, than is there any size limit for the file? Can some crash or error lead to a loss. The app needs to save a month long diary data.
Asked
Active
Viewed 351 times
0
-
Any file format can be "large in size". – CommonsWare Jul 27 '17 at 17:58
-
Why are you asking this? – Ilya Gazman Jul 27 '17 at 18:00
-
@Ilya_Gazman Iam asking for my file should stay safe for long period. – Snowrain Jul 27 '17 at 18:09
-
@Snowrain, sorry I still don't understand the question, please add more details – Ilya Gazman Jul 27 '17 at 18:13
-
@Ilya_Gazman Basically what I wanna ask is that when you are storing a text in a file and keeping on adding than is there any size limit for a .text file. Any crash or mishappening can lead to a loss. – Snowrain Jul 27 '17 at 18:46
2 Answers
0
You can use any file format. For being safe from large size expect a OutOfMemoryException
while handling a large file. So handle a (expected) large file with a OutOfMemoryException
catch block.

Birendra Singh
- 842
- 11
- 19
0
Yes, you can defiantly run out of memory when handling large files, there for a good idea will be to check the available space before writing to the file.
You can find how to do this in here: https://stackoverflow.com/a/8133437/1129332

Ilya Gazman
- 31,250
- 24
- 137
- 216