I am trying to import xls sheet to DB, for that when i am uploading the file the uploaded file is in ByteBuffer Format, i have written a logic which reads as FileInputStream.
Now how do i convert this ByteBuffer to FileInputStream
Here is my Code
ByteBuffer fileBytes = (ByteBuffer) context.get("uploadedFile");
String encoding = System.getProperty("file.encoding");
String filename = Charset.forName(encoding).decode(fileBytes).toString();
filename = filename.replaceAll("\\r", "");
I tried Casting it using ByteArrayInputStream() but looks like it is not working!