When I retrieve rows through N1QL using java sdk, what I get is byteValue because I am saving binary data instead of json and I don’t want to change that.
while (i.hasNext()) {
N1qlQueryRow row = i.next();
byte[] b = row.byteValue();
ByteArrayInputStream bis = new ByteArrayInputStream(b);
try {
ObjectInputStream in = new ObjectInputStream(bis);
List<User> list = (List<User>)in.readObject();
} catch (Exception e) {
LOG.info("Error -------- {}", e.getMessage());
}
}
I get the exception - invalid stream header: 7B0A2020
I can’t successfully convert the byte value to java object. The exception occurs while creating ObjectInputStream.