首页 > 代码库 > BytesWritable 存储问题
BytesWritable 存储问题
public static void main(String args[]){ BytesWritable cv = new BytesWritable(); String str1 = "1234567"; String str2 = "123450"; cv.set(str1.getBytes(), 0, str1.getBytes().length); System.out.println(new String(cv.getBytes())); cv.set(str2.getBytes(), 0, str2.getBytes().length); System.out.println(new String(cv.getBytes())); }output: 1234567 1234507public static void main(String args[]){ BytesWritable cv = new BytesWritable(); String str1 = "1234567"; String str2 = "123450"; cv.set(str1.getBytes(), 0, str1.getBytes().length); System.out.println(new String(cv.getBytes())); cv.setCapacity(0); cv.set(str2.getBytes(), 0, str2.getBytes().length); System.out.println(new String(cv.getBytes())); } output: 1234567 123450
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。