Support Buffer object as input