I have an application that allows the user to sign the tablet and an image will be produced. That part I have working with confirmation as I am able to view the images after they are created and saved.
I am writing them to a .csv file with the following code.
//region - Create CSV file
writer = new CSVWriter(new FileWriter(sdCardPath + "Orders_Summary_Report.csv"), ',', CSVWriter.NO_QUOTE_CHARACTER, CSVWriter.DEFAULT_ESCAPE_CHARACTER, "\r\n");
//writer.writeNext(CSVcursor.getColumnNames()); //Write the column headings first before the looping starts
String [] headings = ("Order Id,Item ID,Item Name,Item Price,Item Count,Item Total,Paid Amount,VOID Order,Payment Method,Order Signature,Member/Authorization,Tab Number,Order Time").split(",");
writer.writeNext(headings);
for(CSVcursor.moveToFirst(); !CSVcursor.isAfterLast(); CSVcursor.moveToNext()) //Loop through all results (use row count of table)
{
String[] entries = (CSVcursor.getInt(CSVcursor.getColumnIndex("orderId"))+ ","
+CSVcursor.getInt(CSVcursor.getColumnIndex("itemId"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("itemName"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("itemPrice")) + ","
+CSVcursor.getInt(CSVcursor.getColumnIndex("itemCount"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("itemTotal"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("orderPaid"))+ ","
+CSVcursor.getInt(CSVcursor.getColumnIndex("orderVoid"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("orderType"))+ ","
+CSVcursor.getBlob(CSVcursor.getColumnIndex("orderSignature"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("referenceId"))+ ","
+CSVcursor.getInt(CSVcursor.getColumnIndex("orderTab"))+ ","
+CSVcursor.getString(CSVcursor.getColumnIndex("orderTime"))).split(","); //Split the string by the delimiter
writer.writeNext(entries); //Write current row of DB to file
writer.flush(); //Flush the stream
}
writer.close();
The file is getting written to successfully, but when I view the .csv file, the column that is saving the blob data looks like this.
B@2342342 B@2123982 B@3952929
It looks like I'm just saving the signature or some other attribute of the file rather than the file itself.
Do I need to stream the blob by bit/buffer into the csv file?
Aucun commentaire:
Enregistrer un commentaire