public Portable[] readPortableArray(String fieldName) throws IOException {
   FieldDefinition fd = cd.getField(fieldName);
   if (fd == null) {
     throw throwUnknownFieldException(fieldName);
   }
   if (fd.getType() != FieldType.PORTABLE_ARRAY) {
     throw new HazelcastSerializationException("Not a Portable array field: " + fieldName);
   }
   final int currentPos = in.position();
   try {
     int pos = readPosition(fd);
     in.position(pos);
     final int len = in.readInt();
     final Portable[] portables = new Portable[len];
     if (len > 0) {
       final int offset = in.position();
       for (int i = 0; i < len; i++) {
         final int start = in.readInt(offset + i * 4);
         in.position(start);
         portables[i] =
             serializer.readAndInitialize(in, fd.getFactoryId(), fd.getClassId(), fd.getVersion());
       }
     }
     return portables;
   } finally {
     in.position(currentPos);
   }
 }
 public ObjectDataInput getRawDataInput() throws IOException {
   if (!raw) {
     int pos = in.readInt(offset + cd.getFieldCount() * 4);
     in.position(pos);
   }
   raw = true;
   return in;
 }
 public DefaultPortableReader(
     PortableSerializer serializer, BufferObjectDataInput in, ClassDefinition cd) {
   this.in = in;
   this.serializer = serializer;
   this.cd = cd;
   try {
     // final position after portable is read
     finalPosition = in.readInt();
   } catch (IOException e) {
     throw new HazelcastSerializationException(e);
   }
   this.offset = in.position();
 }
 public int readInt(String fieldName) throws IOException {
   int pos = readPosition(fieldName, FieldType.INT);
   return in.readInt(pos);
 }
 private int readPosition(FieldDefinition fd) throws IOException {
   return in.readInt(offset + fd.getIndex() * 4);
 }