예제 #1
0
 @Deprecated
 private void readFields(byte[] bytes, int offset, int len) throws IOException {
   if (bytes == null || len <= 0) {
     throw new IllegalArgumentException("Can't build a writable with empty " + "bytes array");
   }
   DataInputBuffer in = new DataInputBuffer();
   try {
     in.reset(bytes, offset, len);
     this.readFields(in);
   } finally {
     in.close();
   }
 }
예제 #2
0
 /**
  * Parses all the HRegionInfo instances from the passed in stream until EOF. Presumes the
  * HRegionInfo's were serialized to the stream with {@link #toDelimitedByteArray()}
  *
  * @param bytes serialized bytes
  * @param offset the start offset into the byte[] buffer
  * @param length how far we should read into the byte[] buffer
  * @return All the hregioninfos that are in the byte array. Keeps reading till we hit the end.
  */
 public static List<HRegionInfo> parseDelimitedFrom(
     final byte[] bytes, final int offset, final int length) throws IOException {
   if (bytes == null) {
     throw new IllegalArgumentException("Can't build an object with empty bytes array");
   }
   DataInputBuffer in = new DataInputBuffer();
   List<HRegionInfo> hris = new ArrayList<HRegionInfo>();
   try {
     in.reset(bytes, offset, length);
     while (in.available() > 0) {
       HRegionInfo hri = parseFrom(in);
       hris.add(hri);
     }
   } finally {
     in.close();
   }
   return hris;
 }