HBase-HFile的读写操作

写入数据:

 

  1. public class TestWrit {  
  2.     private static Configuration cfg = new Configuration();  
  3.     private static final int BLOCK_INDEX_SIZE = 60;  
  4.     private static final int BLOOM_BLOCK_INDEX_SIZE = 10;  
  5.     public TestWrit() {  
  6.         cfg.setInt("hfile.index.block.max.size", BLOCK_INDEX_SIZE);  
  7.         cfg.setInt("io.storefile.bloom.block.size", BLOOM_BLOCK_INDEX_SIZE);  
  8.         //cfg.setBoolean("hbase.regionserver.checksum.verify", true);  
  9.     }  
  10.       
  11.     public static void main(String[] args) throws IOException {  
  12.     }  
  13.       
  14.     public void test() throws IOException {  
  15.         //指定写入的路径  
  16.         Path path = new Path("/data0/hbase/test/myhfile");        
  17.         FileSystem fs = FileSystem.get(cfg);  
  18.         CacheConfig config = new CacheConfig(cfg);  
  19.         FSDataOutputStream fsdos = fs.create(path);  
  20.         //MyDataOutputStream mdos = new MyDataOutputStream(fsdos);  
  21.         //fsdos = new FSDataOutputStream(mdos);  
  22.           
  23.         //创建压缩算法,文件块编码,比较器  
  24.         //HFile默认的比较器是字典排序的,也可以生成一个自定义的比较器,但必须继承KeyComparator  
  25.         Algorithm algorithm = Algorithm.GZ;  
  26.         HFileDataBlockEncoder encoder = new HFileDataBlockEncoderImpl(DataBlockEncoding.DIFF);  
  27.         KeyComparator comparator = new KeyComparator();  
  28.         ChecksumType check = ChecksumType.CRC32;  
  29.       
  30.         //创建HFile写实现类,指定写入的数据块大小,多少字节生成一个checksum  
  31.         int blockSize = 100;  
  32.         int checkPerBytes = 16384;  
  33.         HFileWriterV2 v2 = new HFileWriterV2(cfg, config, fs, path, fsdos, blockSize, algorithm,   
  34.                 encoder, comparator, check, checkPerBytes, true);  
  35.       
  36.     /** 
  37.      * HFile默认的比较器是字典排序的,所以插入的key也必须是字典排序,如果不想按照字典排序, 
  38.      * 这里使用红黑树保证key的有序性 
  39.         String keyPrefix = new String("key"); 
  40.         TreeSet<String> set = new TreeSet<String>(); 
  41.         int len = 100; 
  42.         for(int i=1;i<=len;i++) { 
  43.             set.add(""+i); 
  44.         } 
  45.         for(String key:set) { 
  46.             String generatorKey = keyPrefix+key; 
  47.             v2.append( generator(generatorKey,"c","",System.currentTimeMillis(),VALUES) ); 
  48.         } 
  49.     */  
  50.           
  51.         //创建两个布隆过滤器,指定最大的key数为5  
  52.         int maxKey = 5;  
  53.         BloomFilterWriter bw = BloomFilterFactory.createGeneralBloomAtWrite(cfg, config, BloomType.ROW, maxKey, v2);  
  54.         BloomFilterWriter bw2 = BloomFilterFactory.createDeleteBloomAtWrite(cfg, config, maxKey, v2);  
  55.       
  56.         //生成KeyValue,插入到HFile中,并保存到布隆过滤器中  
  57.         KeyValue kv = generator("key111111111111111111111111","value","f",System.currentTimeMillis(),new byte[]{'2'});  
  58.         addToHFileWirterAndBloomFile(kv,v2,bw,bw2);  
  59.           
  60.         kv = generator("key222222222222222222222222","value","f",System.currentTimeMillis(),new byte[]{'2'});  
  61.         addToHFileWirterAndBloomFile(kv,v2,bw,bw2);  
  62.           
  63.         kv = generator("key333333333333333333333333","value","f",System.currentTimeMillis(),new byte[]{'2'});  
  64.         addToHFileWirterAndBloomFile(kv,v2,bw,bw2);  
  65.           
  66.         //生成meta块,布隆过滤器块,删除的布隆过滤器块  
  67.         //自定义文件信息块的key-value  
  68.         //布隆过滤器加入到HFile.Writer时会判断里面是否有数据,所以要先将key插入到布隆过滤器中,再加入到  
  69.         //Writerv2中  
  70.         v2.addGeneralBloomFilter(bw);  
  71.         v2.addDeleteFamilyBloomFilter(bw2);  
  72.         v2.appendMetaBlock("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"new MyWritable());  
  73.         v2.appendFileInfo(Bytes.toBytes("mykey"), Bytes.toBytes("myvalue"));  
  74.         v2.close();  
  75.     }  
  76.       
  77.     /** 
  78.      * 插入一个KeyValue到HFile中,同时将这个key保存到布隆过滤器中 
  79.      */  
  80.     public void addToHFileWirterAndBloomFile(KeyValue kv, HFileWriterV2 v2, BloomFilterWriter bw, BloomFilterWriter bw2)   
  81.     throws IOException {  
  82.         v2.append( kv );  
  83.         byte[] buf = bw.createBloomKey(kv.getBuffer(),  
  84.                 kv.getRowOffset(), kv.getRowLength(), kv.getBuffer(),  
  85.                 kv.getQualifierOffset(), kv.getQualifierLength());  
  86.         bw.add(buf, 0, buf.length);  
  87.         bw2.add(buf, 0, buf.length);  
  88.       
  89.     }  
  90.       
  91.     /** 
  92.      * 生成KeyValue 
  93.      */  
  94.     public KeyValue generator(String key,String column,String qualifier,long timestamp,byte[] value) {  
  95.         byte[] keyBytes = Bytes.toBytes(key);  
  96.         byte[] familyBytes = Bytes.toBytes(column);  
  97.         byte[] qualifierBytes = Bytes.toBytes(qualifier);  
  98.         Type type = Type.Put;  
  99.         byte[] valueBytes = value;  
  100.         KeyValue kv = new KeyValue(keyBytes, 0, keyBytes.length, familyBytes, 0, familyBytes.length,   
  101.                 qualifierBytes, 0, qualifierBytes.length, timestamp, type, valueBytes, 0, valueBytes.length);         
  102.         return kv;  
  103.     }  
  104. }  

 

 

写入到磁盘时的内存dump:


 

读取操作:

  1. public class TestReader {  
  2.   
  3.     public static String FILE_PATH = "/data0/hbase/test/myhfile";  
  4.     public Configuration cfg = new Configuration();  
  5.     private FSReader fsBlockReader;  
  6.     /** 
  7.      * 二级索引长度 
  8.      */  
  9.     private static final int SECONDARY_INDEX_ENTRY_OVERHEAD = Bytes.SIZEOF_INT + Bytes.SIZEOF_LONG;  
  10.   
  11.     public static void main(String[] args) throws Exception {  
  12.         TestReader t = new TestReader();  
  13.         t.readBloom();  
  14.     }  
  15.   
  16.     /** 
  17.      * 解析布隆过滤器 
  18.      */  
  19.     public void readBloom() throws IOException {  
  20.         // 创建读取路径,本地文件系统,两个读取流  
  21.         Path path = new Path(FILE_PATH);  
  22.         FileSystem fs = FileSystem.getLocal(cfg);  
  23.         CacheConfig config = new CacheConfig(cfg);  
  24.   
  25.         // 由HFile创建出Reader实现类  
  26.         Reader reader = HFile.createReader(fs, path, config);  
  27.   
  28.         // 创建通用布隆过滤器  
  29.         DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();  
  30.         BloomFilter bloomFilter = null;  
  31.         if (bloomMeta != null) {  
  32.             bloomFilter = BloomFilterFactory.createFromMeta(bloomMeta, reader);  
  33.             System.out.println(bloomFilter);  
  34.         }  
  35.   
  36.         //创建删除的布隆过滤器  
  37.         bloomMeta = reader.getDeleteBloomFilterMetadata();  
  38.         bloomFilter = null;  
  39.         if (bloomMeta != null) {  
  40.             bloomFilter = BloomFilterFactory.createFromMeta(bloomMeta, reader);  
  41.             System.out.println(bloomFilter);  
  42.         }  
  43.           
  44.         //meta的读取实现在  HFileReaderV2#getMetaBlock()中  
  45.     }  
  46.   
  47.     /** 
  48.      * 使用Scanner读取数据块内容 
  49.      */  
  50.     @SuppressWarnings("unchecked")  
  51.     public void readScan() throws IOException, SecurityException,  
  52.             NoSuchMethodException, IllegalArgumentException,  
  53.             IllegalAccessException, InvocationTargetException {  
  54.         // 创建读取路径,本地文件系统,两个读取流  
  55.         Path path = new Path(FILE_PATH);  
  56.         FileSystem fs = FileSystem.getLocal(cfg);  
  57.         CacheConfig config = new CacheConfig(cfg);  
  58.         FSDataInputStream fsdis = fs.open(path);  
  59.         FSDataInputStream fsdisNoFsChecksum = fsdis;  
  60.         HFileSystem hfs = new HFileSystem(fs);  
  61.         long size = fs.getFileStatus(path).getLen();  
  62.   
  63.         // 由读FS读取流,文件长度,就可以读取到尾文件块  
  64.         FixedFileTrailer trailer = FixedFileTrailer.readFromStream(fsdis, size);  
  65.   
  66.         // 根据尾文件块,和其他相关信息,创建HFile.Reader实现  
  67.         HFileReaderV2 v2 = new HFileReaderV2(path, trailer, fsdis,  
  68.                 fsdisNoFsChecksum, size, true, config, DataBlockEncoding.NONE,  
  69.                 hfs);  
  70.         System.out.println(v2);  
  71.   
  72.         // 读取FileInfo中的内容  
  73.         Method method = v2.getClass().getMethod("loadFileInfo"new Class[] {});  
  74.         Map<byte[], byte[]> fileInfo = (Map<byte[], byte[]>) method.invoke(v2,  
  75.                 new Object[] {});  
  76.         Iterator<Entry<byte[], byte[]>> iter = fileInfo.entrySet().iterator();  
  77.         while (iter.hasNext()) {  
  78.             Entry<byte[], byte[]> entry = iter.next();  
  79.             System.out.println(Bytes.toString(entry.getKey()) + " = "  
  80.                     + Bytes.toShort(entry.getValue()));  
  81.         }  
  82.   
  83.         // 由Reader实现创建扫描器Scanner,负责读取数据块  
  84.         // 并遍历所有的数据块中的KeyValue  
  85.         HFileScanner scanner = v2.getScanner(falsefalse);  
  86.         scanner.seekTo();  
  87.         System.out.println(scanner.getKeyValue());  
  88.   
  89.         KeyValue kv = scanner.getKeyValue();  
  90.         while (scanner.next()) {  
  91.             kv = scanner.getKeyValue();  
  92.             System.out.println(kv);  
  93.         }  
  94.         v2.close();  
  95.   
  96.     }  
  97.   
  98.     /** 
  99.      * 解析HFile中的数据索引 
  100.      */  
  101.     @SuppressWarnings({ "unused""unchecked" })  
  102.     public void readIndex() throws Exception {  
  103.         // 创建读取路径,本地文件系统,两个读取流  
  104.         // 由读FS读取流,文件长度,就可以读取到尾文件块  
  105.         Path path = new Path(FILE_PATH);  
  106.         FileSystem fs = FileSystem.getLocal(cfg);  
  107.         CacheConfig config = new CacheConfig(cfg);  
  108.         FSDataInputStream fsdis = fs.open(path);  
  109.         FSDataInputStream fsdisNoFsChecksum = fsdis;  
  110.         HFileSystem hfs = new HFileSystem(fs);  
  111.         long size = fs.getFileStatus(path).getLen();  
  112.         FixedFileTrailer trailer = FixedFileTrailer.readFromStream(fsdis, size);  
  113.   
  114.         // 下面创建的一些类,在Reader实现类的构造函数中也可以找到,创建具体文件读取实现FSReader  
  115.         // 由于这个类没有提供对外的创建方式,只能通过反射构造 FSReader  
  116.         Compression.Algorithm compressAlgo = trailer.getCompressionCodec();  
  117.         Class<?> clazz = Class  
  118.                 .forName("org.apache.hadoop.hbase.io.hfile.HFileBlock$FSReaderV2");  
  119.         java.lang.reflect.Constructor<FSReader> constructor = (Constructor<FSReader>) clazz  
  120.                 .getConstructor(new Class[] { FSDataInputStream.class,  
  121.                         FSDataInputStream.class, Compression.Algorithm.class,  
  122.                         long.classint.class, HFileSystem.class, Path.class });  
  123.         constructor.setAccessible(true);  
  124.         fsBlockReader = constructor.newInstance(fsdis, fsdis, compressAlgo,  
  125.                 size, 0, hfs, path);  
  126.   
  127.         // 创建比较器,比较器是定义在尾文件块中  
  128.         RawComparator<byte[]> comparator = FixedFileTrailer  
  129.                 .createComparator(KeyComparator.class.getName());  
  130.   
  131.         // 创建读取数据块的根索引  
  132.         BlockIndexReader dataBlockIndexReader = new HFileBlockIndex.BlockIndexReader(  
  133.                 comparator, trailer.getNumDataIndexLevels());  
  134.   
  135.         // 创建读取元数据快的根索引  
  136.         BlockIndexReader metaBlockIndexReader = new HFileBlockIndex.BlockIndexReader(  
  137.                 Bytes.BYTES_RAWCOMPARATOR, 1);  
  138.   
  139.         // 创建 HFileBlock 迭代器  
  140.         HFileBlock.BlockIterator blockIter = fsBlockReader.blockRange(  
  141.                 trailer.getLoadOnOpenDataOffset(),  
  142.                 size - trailer.getTrailerSize());  
  143.   
  144.         // 读取数据文件根索引  
  145.         dataBlockIndexReader.readMultiLevelIndexRoot(  
  146.                 blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX),  
  147.                 trailer.getDataIndexCount());  
  148.   
  149.         // 读取元数据根索引  
  150.         metaBlockIndexReader.readRootIndex(  
  151.                 blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX),  
  152.                 trailer.getMetaIndexCount());  
  153.   
  154.         // 读取FileInfo块中的信息  
  155.         // 由于FileInfo块不是public的,所以定义了一个MyFileInfo,内容跟FileInfo一样  
  156.         long fileinfoOffset = trailer.getFileInfoOffset();  
  157.         HFileBlock fileinfoBlock = fsBlockReader.readBlockData(fileinfoOffset,  
  158.                 -1, -1false);  
  159.         MyFileInfo fileinfo = new MyFileInfo();  
  160.         fileinfo.readFields(fileinfoBlock.getByteStream());  
  161.         int avgKeyLength = Bytes.toInt(fileinfo.get(MyFileInfo.AVG_KEY_LEN));  
  162.         int avgValueLength = Bytes  
  163.                 .toInt(fileinfo.get(MyFileInfo.AVG_VALUE_LEN));  
  164.         long entryCount = trailer.getEntryCount();  
  165.         System.out.println("avg key length=" + avgKeyLength);  
  166.         System.out.println("avg value length=" + avgValueLength);  
  167.         System.out.println("entry count=" + entryCount);  
  168.   
  169.         int numDataIndexLevels = trailer.getNumDataIndexLevels();  
  170.         if (numDataIndexLevels > 1) {  
  171.             // 大于一层  
  172.             iteratorRootIndex(dataBlockIndexReader);  
  173.         } else {  
  174.             // 单根索引  
  175.             iteratorSingleIndex(dataBlockIndexReader);  
  176.         }  
  177.   
  178.         fsdis.close();  
  179.         fsdisNoFsChecksum.close();  
  180.     }  
  181.   
  182.     /** 
  183.      * 解析单层索引 
  184.      */  
  185.     public void iteratorSingleIndex(BlockIndexReader dataBlockIndex) {  
  186.         for (int i = 0; i < dataBlockIndex.getRootBlockCount(); i++) {  
  187.             byte[] keyCell = dataBlockIndex.getRootBlockKey(i);  
  188.             int blockDataSize = dataBlockIndex.getRootBlockDataSize(i);  
  189.             String rowKey = parseKeyCellRowkey(keyCell);  
  190.             System.out.println("rowkey=" + rowKey + "\tdata size="  
  191.                     + blockDataSize);  
  192.         }  
  193.     }  
  194.   
  195.     /** 
  196.      * 解析多层索引,首先解析根索引 
  197.      */  
  198.     public void iteratorRootIndex(BlockIndexReader dataBlockIndex)  
  199.             throws IOException {  
  200.         for (int i = 0; i < dataBlockIndex.getRootBlockCount(); i++) {  
  201.             long offset = dataBlockIndex.getRootBlockOffset(i);  
  202.             int onDiskSize = dataBlockIndex.getRootBlockDataSize(i);  
  203.             iteratorNonRootIndex(offset, onDiskSize);  
  204.         }  
  205.     }  
  206.   
  207.     /** 
  208.      * 递归解析每个中间索引 
  209.      */  
  210.     public void iteratorNonRootIndex(long offset, int onDiskSize)  
  211.             throws IOException {  
  212.         HFileBlock block = fsBlockReader.readBlockData(offset, onDiskSize, -1,  
  213.                 false);  
  214.         if (block.getBlockType().equals(BlockType.LEAF_INDEX)) {  
  215.             parseLeafIndex(block);  
  216.             return;  
  217.         }  
  218.         // 开始计算中间层索引的 每个key位置  
  219.         ByteBuffer buffer = block.getBufferReadOnly();  
  220.   
  221.         buffer = ByteBuffer.wrap(buffer.array(),  
  222.                 buffer.arrayOffset() + block.headerSize(),  
  223.                 buffer.limit() - block.headerSize()).slice();  
  224.         int indexCount = buffer.getInt();  
  225.   
  226.         // 二级索引全部偏移量,二级索引数据+二级索引总数(int)+索引文件总大小(int)  
  227.         int entriesOffset = Bytes.SIZEOF_INT * (indexCount + 2);  
  228.         for (int i = 0; i < indexCount; i++) {  
  229.             // 二级索引指向的偏移量  
  230.             // 如当前遍历到第一个key,那么二级索引偏移量就是 第二个int(第一个是索引总数)  
  231.             int indexKeyOffset = buffer.getInt(Bytes.SIZEOF_INT * (i + 1));  
  232.             long blockOffsetIndex = buffer.getLong(indexKeyOffset  
  233.                     + entriesOffset);  
  234.             int blockSizeIndex = buffer.getInt(indexKeyOffset + entriesOffset  
  235.                     + Bytes.SIZEOF_LONG);  
  236.             iteratorNonRootIndex(blockOffsetIndex, blockSizeIndex);  
  237.         }  
  238.     }  
  239.   
  240.     /** 
  241.      * 解析叶索引 
  242.      */  
  243.     public void parseLeafIndex(HFileBlock block) {  
  244.         // 开始计算中间层索引的 每个key位置  
  245.         ByteBuffer buffer = block.getBufferReadOnly();  
  246.         buffer = ByteBuffer.wrap(buffer.array(),  
  247.                 buffer.arrayOffset() + block.headerSize(),  
  248.                 buffer.limit() - block.headerSize()).slice();  
  249.         int indexCount = buffer.getInt();  
  250.   
  251.         // 二级索引全部偏移量,二级索引数据+二级索引总数(int)+索引文件总大小(int)  
  252.         int entriesOffset = Bytes.SIZEOF_INT * (indexCount + 2);  
  253.         for (int i = 0; i < indexCount; i++) {  
  254.             // 二级索引指向的偏移量  
  255.             // 如当前遍历到第一个key,那么二级索引偏移量就是 第二个int(第一个是索引总数)  
  256.             int indexKeyOffset = buffer.getInt(Bytes.SIZEOF_INT * (i + 1));  
  257.   
  258.             // 全部二级索引长度+key偏移位置+ 块索引offset(long)+块大小(int)  
  259.             // 可以计算出真实的key的偏移位置  
  260.             int KeyOffset = entriesOffset + indexKeyOffset  
  261.                     + SECONDARY_INDEX_ENTRY_OVERHEAD;  
  262.             // long blockOffsetIndex =  
  263.             // buffer.getLong(indexKeyOffset+entriesOffset);  
  264.             int blockSizeIndex = buffer.getInt(indexKeyOffset + entriesOffset  
  265.                     + Bytes.SIZEOF_LONG);  
  266.   
  267.             // 计算key的长度  
  268.             int length = buffer.getInt(Bytes.SIZEOF_INT * (i + 2))  
  269.                     - indexKeyOffset - SECONDARY_INDEX_ENTRY_OVERHEAD;  
  270.   
  271.             // 一个key  
  272.             // cell包含了key长度(2字节),key,family长度(1字节),family,qualifier,timestampe(8字节),keytype(1字节)  
  273.             // 这里只需要key就可以了  
  274.             byte[] keyCell = new byte[length];  
  275.             System.arraycopy(buffer.array(), buffer.arrayOffset() + KeyOffset,  
  276.                     keyCell, 0, length);  
  277.   
  278.             String rowKey = parseKeyCellRowkey(keyCell);  
  279.             System.out.println("rowkey=" + rowKey + "\t blockSizeIndex="  
  280.                     + blockSizeIndex);  
  281.         }  
  282.     }  
  283.   
  284.     /** 
  285.      * 通过keycell,解析出rowkey 
  286.      */  
  287.     public static String parseKeyCellRowkey(byte[] cell) {  
  288.         if (cell == null || cell.length < 3) {  
  289.             throw new IllegalArgumentException("cell length is illegal");  
  290.         }  
  291.         int high = (cell[0] >> 8) & 0xFF;  
  292.         int low = cell[1] & 0xFF;  
  293.         int keySize = high + low;  
  294.         byte[] key = new byte[keySize];  
  295.         System.arraycopy(cell, 2, key, 0, key.length);  
  296.         return Bytes.toString(key);  
  297.     }  
  298.   
  299. }  

 

工具类:

  1. /** 
  2.  * 自定义这样的类原因是HBase的实现是非public类 
  3.  */  
  4. public class MyFileInfo extends HbaseMapWritable<byte[], byte[]> {  
  5.     /** 
  6.      * hfile保留的key,以"hfile."开头 
  7.      */  
  8.     public static final String RESERVED_PREFIX = "hfile.";  
  9.       
  10.     /** 
  11.      * hfile前缀的二进制表示 
  12.      */  
  13.     public static final byte[] RESERVED_PREFIX_BYTES = Bytes  
  14.             .toBytes(RESERVED_PREFIX);  
  15.       
  16.     /** 
  17.      * last key 
  18.      */  
  19.     public static final byte[] LASTKEY = Bytes.toBytes(RESERVED_PREFIX + "LASTKEY");  
  20.       
  21.     /** 
  22.      * 平均key长度 
  23.      */  
  24.     public static final byte[] AVG_KEY_LEN = Bytes.toBytes(RESERVED_PREFIX + "AVG_KEY_LEN");  
  25.       
  26.     /** 
  27.      * 平均value长度 
  28.      */  
  29.     public static final byte[] AVG_VALUE_LEN = Bytes.toBytes(RESERVED_PREFIX + "AVG_VALUE_LEN");  
  30.       
  31.     /** 
  32.      * 比较器 
  33.      */  
  34.     public static final byte[] COMPARATOR = Bytes.toBytes(RESERVED_PREFIX + "COMPARATOR");  
  35.   
  36.     /** 
  37.      * 增加一个key/value 对到file info中,可选的可以检查key的前缀 
  38.      */  
  39.     public MyFileInfo append(final byte[] k, final byte[] v, final boolean checkPrefix) throws IOException {  
  40.         if (k == null || v == null) {  
  41.             throw new NullPointerException("Key nor value may be null");  
  42.         }  
  43.         if (checkPrefix && isReservedFileInfoKey(k)) {  
  44.             throw new IOException("Keys with a " + SaeFileInfo.RESERVED_PREFIX  
  45.                     + " are reserved");  
  46.         }  
  47.         put(k, v);  
  48.         return this;  
  49.     }  
  50.   
  51.     /** 
  52.      * 检查当前的key是否以保留的前缀开头的 
  53.      */  
  54.     public static boolean isReservedFileInfoKey(byte[] key) {  
  55.         return Bytes.startsWith(key, SaeFileInfo.RESERVED_PREFIX_BYTES);  
  56.     }  
  57.   
  58. }  
  59.   
  60.   
  61.   
  62. /** 
  63.  * 自定义序列化写入实现类 
  64.  * 
  65.  */  
  66. public class MyWritable implements Writable {  
  67.   
  68.     @Override  
  69.     public void readFields(DataInput input) throws IOException {  
  70.         input.readInt();  
  71.     }  
  72.   
  73.     @Override  
  74.     public void write(DataOutput out) throws IOException {  
  75.         out.write(123456);  
  76.     }  
  77. }  

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值