0
我正在学习Cassandra并编写了一个restclient,它将从DB读取文件。cassandra行提取垃圾字符
以下是我从DB中检索数据的代码。
ResultSet rs = getFile(fileName);
Row row=rs.one();
ByteBuffer filecontent =row.getBytes("file_content");
byte[] data = new byte[filecontent.remaining()];
ByteBuffer bb = filecontent.get(data);
String filelocation = row.getString("file_location");
String filename = row.getString("filename");
ByteArrayInputStream filecontentfromDB= new ByteArrayInputStream(bb.array());
File file=writeToFile(filecontentfromDB,fileName);
if (rs == null) {
return null;
}
return file;
当我看到返回的文件时,我发现一些垃圾字符在开头,然后是我的文件内容。
请帮我去除垃圾数据