We currently doing research on how append files in CSV file with Java programming language.
Therefore, we looking for some input & guidance on this, which will much useful for me.
Your help & guidance will be much appreciated.
Thanks in advance.
We currently doing research on how append files in CSV file with Java programming language.
Therefore, we looking for some input & guidance on this, which will much useful for me.
Your help & guidance will be much appreciated.
Thanks in advance.
No, there is not, but the reason why is not specific to the Java programming language. Rather, it pertains to the nature of CSV in general.
CSV stands for "comma separated values", and it is a way to store database information in plaintext. If you read RFC 4180, you'll see a formal definition outlined there.
Part of the definition of CSV is that it is stored in plain text. That means that only numbers and strings can be stored in CSV files.
Thus, it is impossible to store image files in CSV files, unless you serialize your images into strings. More info on how to do that is here: Serialize image to a StringHow can I convert an image to a base64 string using Java?.
Of course it's possible. All you need is to convert your binary data to a Base 64 string representation.
Apache commons codec does this for you:
Just use:
byte[] binaryData = someMethodToReadYourFileIntoBytes();
String encodedData = Base64.encodeBase64String(binaryData);`
Refer to the javadoc for more information and other options on how to go about it.
Hope it helps.