Beispiel #1
0
  /** Creates new PostTable */
  protected PostTable(final DirectoryEntry de, final DataInput di) throws IOException {
    this.de = (DirectoryEntry) de.clone();
    version = di.readInt();
    italicAngle = di.readInt();
    underlinePosition = di.readShort();
    underlineThickness = di.readShort();
    isFixedPitch = di.readInt();
    minMemType42 = di.readInt();
    maxMemType42 = di.readInt();
    minMemType1 = di.readInt();
    maxMemType1 = di.readInt();

    if (version == 0x00020000) {
      numGlyphs = di.readUnsignedShort();
      glyphNameIndex = new int[numGlyphs];
      for (int i = 0; i < numGlyphs; i++) {
        glyphNameIndex[i] = di.readUnsignedShort();
      }
      int h = highestGlyphNameIndex();
      if (h > 257) {
        h -= 257;
        psGlyphName = new String[h];
        for (int i = 0; i < h; i++) {
          final int len = di.readUnsignedByte();
          final byte[] buf = new byte[len];
          di.readFully(buf);
          psGlyphName[i] = new String(buf);
        }
      }
      // } else if (version == 0x00025000) {
      // } else if (version == 0x00030000) {
    }
  }
 @Override
 public void readFields(DataInput in) throws IOException {
   short numvbuckets = in.readShort();
   for (int i = 0; i < numvbuckets; i++) {
     vbuckets.add(new Integer(in.readShort()));
   }
 }
 public void func_73267_a(DataInput p_73267_1_) throws IOException {
   this.field_73444_a = p_73267_1_.readByte();
   this.field_73442_b = p_73267_1_.readShort();
   this.field_73443_c = p_73267_1_.readByte();
   this.field_73440_d = p_73267_1_.readShort();
   this.field_73439_f = p_73267_1_.readByte();
   this.field_73441_e = func_73276_c(p_73267_1_);
 }
  /**
   * Un-marshal an object instance from the data input stream
   *
   * @param o the object to un-marshal
   * @param dataIn the data input stream to build the object from
   * @throws IOException
   */
  public void tightUnmarshal(
      OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
    super.tightUnmarshal(wireFormat, o, dataIn, bs);

    ConsumerInfo info = (ConsumerInfo) o;
    info.setConsumerId(
        (org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setBrowser(bs.readBoolean());
    info.setDestination(
        (org.apache.activemq.command.ActiveMQDestination)
            tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setPrefetchSize(dataIn.readInt());
    info.setMaximumPendingMessageLimit(dataIn.readInt());
    info.setDispatchAsync(bs.readBoolean());
    info.setSelector(tightUnmarshalString(dataIn, bs));
    info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
    info.setNoLocal(bs.readBoolean());
    info.setExclusive(bs.readBoolean());
    info.setRetroactive(bs.readBoolean());
    info.setPriority(dataIn.readByte());

    if (bs.readBoolean()) {
      short size = dataIn.readShort();
      org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
      for (int i = 0; i < size; i++) {
        value[i] =
            (org.apache.activemq.command.BrokerId)
                tightUnmarsalNestedObject(wireFormat, dataIn, bs);
      }
      info.setBrokerPath(value);
    } else {
      info.setBrokerPath(null);
    }
    info.setAdditionalPredicate(
        (org.apache.activemq.filter.BooleanExpression)
            tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setNetworkSubscription(bs.readBoolean());
    info.setOptimizedAcknowledge(bs.readBoolean());
    info.setNoRangeAcks(bs.readBoolean());

    if (bs.readBoolean()) {
      short size = dataIn.readShort();
      org.apache.activemq.command.ConsumerId value[] =
          new org.apache.activemq.command.ConsumerId[size];
      for (int i = 0; i < size; i++) {
        value[i] =
            (org.apache.activemq.command.ConsumerId)
                tightUnmarsalNestedObject(wireFormat, dataIn, bs);
      }
      info.setNetworkConsumerPath(value);
    } else {
      info.setNetworkConsumerPath(null);
    }
  }
  @Override
  public void readFields(DataInput in) throws IOException {
    initialize();
    int numFields = in.readInt();

    for (int i = 0; i < numFields; ++i) {
      byte type = in.readByte();

      if (type == BYTE) {
        fields.add(in.readByte());
      } else if (type == BOOLEAN) {
        fields.add(in.readBoolean());
      } else if (type == INT) {
        fields.add(in.readInt());
      } else if (type == LONG) {
        fields.add(in.readLong());
      } else if (type == FLOAT) {
        fields.add(in.readFloat());
      } else if (type == DOUBLE) {
        fields.add(in.readDouble());
      } else if (type == STRING) {
        fields.add(in.readUTF());
      } else if (type == BYTE_ARRAY) {
        int len = in.readShort();
        byte[] bytes = new byte[len];
        in.readFully(bytes);
        fields.add(bytes);
      } else {
        throw new IllegalArgumentException("Failed encoding, unknown element type in stream");
      }
    }
  }
 protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn)
     throws IOException {
   if (wireFormat.isCacheEnabled()) {
     if (dataIn.readBoolean()) {
       short index = dataIn.readShort();
       DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn);
       wireFormat.setInUnmarshallCache(index, object);
       return object;
     } else {
       short index = dataIn.readShort();
       return wireFormat.getFromUnmarshallCache(index);
     }
   } else {
     return wireFormat.looseUnmarshalNestedObject(dataIn);
   }
 }
  public GlyfCompositeDescript(GlyfTable parentTable, int glyphIndex, DataInput di)
      throws IOException {
    super(parentTable, glyphIndex, (short) -1, di);

    // Get all of the composite components
    GlyfCompositeComp comp;
    int firstIndex = 0;
    int firstContour = 0;
    try {
      do {
        _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di));
        GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex());
        if (desc != null) {
          firstIndex += desc.getPointCount();
          firstContour += desc.getContourCount();
        }
      } while ((comp.getFlags() & GlyfCompositeComp.MORE_COMPONENTS) != 0);

      // Are there hinting intructions to read?
      if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) {
        readInstructions(di, di.readShort());
      }
    } catch (IOException e) {
      throw e;
      //        } catch (Exception e) {
      //            int foo = 0;
    }
  }
 @Override
 public void parseFromInput(DataInput in) throws IOException {
   this.offer = new boolean[in.readShort()];
   for (int i = 0; i < this.offer.length; i++) {
     this.offer[i] = in.readBoolean();
   }
 }
 public void a(DataInput datainput) {
   this.a = datainput.readInt();
   this.b = datainput.readShort();
   this.c = datainput.readInt();
   this.d = datainput.readByte();
   this.e = d(datainput);
 }
 @Override
 public void parseFromInput(DataInput in) throws IOException {
   this.accountListId = in.readInt();
   this.accountIds = new String[in.readShort()];
   for (int i = 0; i < this.accountIds.length; i++) {
     this.accountIds[i] = in.readUTF();
   }
 }
Beispiel #11
0
 @Override
 public short readShort() {
   try {
     return input.readShort();
   } catch (IOException e) {
     throw new IllegalStateException(e);
   }
 }
Beispiel #12
0
 public void readFrom(DataInput in) throws Exception {
   type = in.readByte();
   switch (type) {
     case DATA:
       seqno = Bits.readLong(in);
       conn_id = in.readShort();
       first = in.readBoolean();
       break;
     case ACK:
       seqno = Bits.readLong(in);
       conn_id = in.readShort();
       break;
     case SEND_FIRST_SEQNO:
       seqno = Bits.readLong(in);
       break;
   }
 }
 public void readFields(DataInput in) throws IOException {
   byte version = in.readByte();
   switch (version) {
     case 1:
       majorCode = in.readByte();
       minorCode = in.readShort();
       args = WritableUtils.readCompressedStringArray(in);
       break;
     case 2:
       majorCode = in.readByte();
       minorCode = in.readShort();
       args = WritableUtils.readStringArray(in);
       break;
     default:
       throw new VersionMismatchException(VERSION, version);
   }
 }
  /** Abstract. Reads the raw packet data from the data stream. */
  public void readPacketData(DataInput par1DataInput) throws IOException {
    this.windowId = par1DataInput.readByte();
    short var2 = par1DataInput.readShort();
    this.itemStack = new ItemStack[var2];

    for (int var3 = 0; var3 < var2; ++var3) {
      this.itemStack[var3] = readItemStack(par1DataInput);
    }
  }
Beispiel #15
0
 protected VheaTable(DirectoryEntry de, DataInput di) throws IOException {
   _de = (DirectoryEntry) de.clone();
   _version = di.readInt();
   _ascent = di.readShort();
   _descent = di.readShort();
   _lineGap = di.readShort();
   _advanceHeightMax = di.readShort();
   _minTopSideBearing = di.readShort();
   _minBottomSideBearing = di.readShort();
   _yMaxExtent = di.readShort();
   _caretSlopeRise = di.readShort();
   _caretSlopeRun = di.readShort();
   for (int i = 0; i < 5; ++i) {
     di.readShort();
   }
   _metricDataFormat = di.readShort();
   _numberOfLongVerMetrics = di.readUnsignedShort();
 }
  /** Abstract. Reads the raw packet data from the data stream. */
  public void readPacketData(DataInput par1DataInput) throws IOException {
    this.xPosition = par1DataInput.readInt();
    this.yPosition = par1DataInput.readShort();
    this.zPosition = par1DataInput.readInt();
    this.signLines = new String[4];

    for (int i = 0; i < 4; ++i) {
      this.signLines[i] = readString(par1DataInput, 15);
    }
  }
  /** {@inheritDoc} */
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);

    // TODO: move it to DatanodeID once HADOOP-2797 has been committed
    this.ipcPort = in.readShort() & 0x0000ffff;

    storageInfo.layoutVersion = in.readInt();
    storageInfo.namespaceID = in.readInt();
    storageInfo.cTime = in.readLong();
  }
 protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn)
     throws IOException {
   if (dataIn.readBoolean()) {
     String clazz = looseUnmarshalString(dataIn);
     String message = looseUnmarshalString(dataIn);
     Throwable o = createThrowable(clazz, message);
     if (wireFormat.isStackTraceEnabled()) {
       if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
         StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
         for (int i = 0; i < ss.length; i++) {
           try {
             ss[i] =
                 (StackTraceElement)
                     STACK_TRACE_ELEMENT_CONSTRUCTOR.newInstance(
                         new Object[] {
                           looseUnmarshalString(dataIn),
                           looseUnmarshalString(dataIn),
                           looseUnmarshalString(dataIn),
                           Integer.valueOf(dataIn.readInt())
                         });
           } catch (IOException e) {
             throw e;
           } catch (Throwable e) {
           }
         }
         o.setStackTrace(ss);
       } else {
         short size = dataIn.readShort();
         for (int i = 0; i < size; i++) {
           looseUnmarshalString(dataIn);
           looseUnmarshalString(dataIn);
           looseUnmarshalString(dataIn);
           dataIn.readInt();
         }
       }
       o.initCause(looseUnmarsalThrowable(wireFormat, dataIn));
     }
     return o;
   } else {
     return null;
   }
 }
Beispiel #19
0
  protected static Header readHeader(DataInput in) throws Exception {
    short magic_number = in.readShort();
    Class clazz = ClassConfigurator.get(magic_number);
    if (clazz == null)
      throw new IllegalArgumentException(
          "magic number " + magic_number + " is not available in magic map");

    Header hdr = (Header) clazz.newInstance();
    hdr.readFrom(in);
    return hdr;
  }
Beispiel #20
0
 @Override
 public void parseFromInput(DataInput in) throws IOException {
   this.tickId = in.readInt();
   this.time = in.readInt();
   this.newPosition.parseFromInput(in);
   this.records = new LocationRecord[in.readShort()];
   for (int i = 0; i < this.records.length; i++) {
     LocationRecord record = new LocationRecord();
     record.parseFromInput(in);
     this.records[i] = record;
   }
 }
Beispiel #21
0
 public void readFrom(DataInput in) throws Exception {
   type = in.readByte();
   switch (type) {
     case DATA:
       seqno = Util.readLong(in);
       conn_id = in.readShort();
       first = in.readBoolean();
       break;
     case XMIT_REQ:
       break;
     case STABLE:
       long[] seqnos = Util.readLongSequence(in);
       seqno = seqnos[0];
       high_seqno = seqnos[1];
       conn_id = in.readShort();
       break;
     case SEND_FIRST_SEQNO:
       seqno = Util.readLong(in);
       break;
   }
 }
  /**
   * Fill out this instance of the message using the <code>DataInput</code> Required to be a {@link
   * com.gemstone.gemfire.DataSerializable}Note: must be symmetric with {@link
   * #toData(DataOutput)}in what it reads
   */
  @Override
  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);
    this.flags = in.readShort();
    setFlags(this.flags, in);
    this.regionPath = DataSerializer.readString(in);

    // extra field post 9.0
    if (InternalDataSerializer.getVersionForDataStream(in).compareTo(Version.GFE_90) >= 0) {
      this.isTransactionDistributed = in.readBoolean();
    }
  }
Beispiel #23
0
 public APMPartition(DataInput di) throws IOException {
   // 2*2 + 4*3 + 32*2 + 10*4 + 16 + 188*2 = 512
   pmSig = di.readShort() & 0xffff;
   pmSigPad = di.readShort() & 0xffff;
   pmMapBlkCnt = di.readInt() & 0xffffffffL;
   pmPyPartStart = di.readInt() & 0xffffffffL;
   pmPartBlkCnt = di.readInt() & 0xffffffffL;
   di.readFully(pmPartName);
   di.readFully(pmParType);
   pmLgDataStart = di.readInt() & 0xffffffffL;
   pmDataCnt = di.readInt() & 0xffffffffL;
   pmPartStatus = di.readInt() & 0xffffffffL;
   pmLgBootStart = di.readInt() & 0xffffffffL;
   pmBootSize = di.readInt() & 0xffffffffL;
   pmBootAddr = di.readInt() & 0xffffffffL;
   pmBootAddr2 = di.readInt() & 0xffffffffL;
   pmBootEntry = di.readInt() & 0xffffffffL;
   pmBootEntry2 = di.readInt() & 0xffffffffL;
   pmBootCksum = di.readInt() & 0xffffffffL;
   di.readFully(pmProcessor);
   for (int i = 0; i < pmPad.length; ++i) pmPad[i] = di.readShort() & 0xffff;
 }
Beispiel #24
0
  public void readFrom(DataInput in) throws Exception {

    // 1. read the leading byte first
    byte leading = in.readByte();

    // 2. the flags
    flags = in.readShort();

    // 3. dest_addr
    if (Util.isFlagSet(leading, DEST_SET)) dest_addr = Util.readAddress(in);

    // 4. src_addr
    if (Util.isFlagSet(leading, SRC_SET)) src_addr = Util.readAddress(in);

    // 5. buf
    if (Util.isFlagSet(leading, BUF_SET)) {
      int len = in.readInt();
      buf = new byte[len];
      in.readFully(buf, 0, len);
      length = len;
    }

    // 6. headers
    int len = in.readShort();
    headers = createHeaders(len);

    short[] ids = headers.getRawIDs();
    Header[] hdrs = headers.getRawHeaders();

    for (int i = 0; i < len; i++) {
      short id = in.readShort();
      Header hdr = readHeader(in);
      ids[i] = id;
      hdrs[i] = hdr;
    }
  }
Beispiel #25
0
    public void readFrom(DataInput in) throws Exception {
      type = Type.values()[in.readByte()];
      // We can't use Util.readObject since it's size is limited to 2^15-1
      try {
        short first = in.readShort();
        if (first == -1) {
          object = Util.readGenericStreamable(in);
        } else {
          ByteBuffer bb = ByteBuffer.allocate(4);
          bb.putShort(first);
          bb.putShort(in.readShort());

          int size = bb.getInt(0);
          byte[] bytes = new byte[size];
          in.readFully(bytes, 0, size);
          object = Util.objectFromByteBuffer(bytes);
        }
      } catch (IOException e) {
        throw e;
      } catch (Exception e) {
        throw new IOException("Exception encountered while serializing execution request", e);
      }
      request = in.readLong();
    }
Beispiel #26
0
 /**
  * Read this pixel tissues object from the given data input stream.
  *
  * <p><I>Note:</I> The file index and pixel index are not read.
  *
  * @param in Data input stream.
  * @exception IOException Thrown if an I/O error occurred.
  */
 public void read(DataInput in) throws IOException {
   int L = in.readShort();
   if (L == 0) {
     rho = null;
     R1 = null;
   } else {
     rho = new double[L];
     R1 = new double[L];
     for (int i = 0; i < L; ++i) {
       rho[i] = in.readDouble();
     }
     for (int i = 0; i < L; ++i) {
       R1[i] = in.readDouble();
     }
   }
 }
  public static PCRecord deserialize(DataInput in, Map<Integer, String> fromIntMap) {
    PCRecord ret = new PCRecord();
    try {
      for (PCRecord.StrField fld : PCRecord.StrField.values()) {
        int id = in.readInt();
        ret.setField(fld, fromIntMap.get(id));
      }
      ret.setLatitude(new BigDecimal(in.readUTF()));
      ret.setLongitude(new BigDecimal(in.readUTF()));
      ret.setAccuracy(in.readShort());
    } catch (Throwable e) {
      throw new RuntimeException(e);
    }

    return ret;
  }
 public long tightUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs)
     throws IOException {
   if (bs.readBoolean()) {
     if (bs.readBoolean()) {
       return dataIn.readLong();
     } else {
       return toLong(dataIn.readInt());
     }
   } else {
     if (bs.readBoolean()) {
       return toLong(dataIn.readShort());
     } else {
       return 0;
     }
   }
 }
 @SuppressWarnings("deprecation")
 protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException {
   if (bs.readBoolean()) {
     if (bs.readBoolean()) {
       int size = dataIn.readShort();
       byte data[] = new byte[size];
       dataIn.readFully(data);
       // Yes deprecated, but we know what we are doing.
       // This allows us to create a String from a ASCII byte array. (no UTF-8 decoding)
       return new String(data, 0);
     } else {
       return dataIn.readUTF();
     }
   } else {
     return null;
   }
 }
  public void readData(DataInput din) throws IOException {

    m_Reference = din.readShort();
    // read lengths
    int wc = din.readUnsignedShort();
    int bc = din.readUnsignedByte();

    // read values
    if (m_NonWordDataHandler == null) {
      m_Registers = new Register[wc];
      ProcessImageFactory pimf = ModbusCoupler.getReference().getProcessImageFactory();
      for (int i = 0; i < wc; i++) {
        m_Registers[i] = pimf.createRegister(din.readByte(), din.readByte());
      }
    } else {
      m_NonWordDataHandler.readData(din, m_Reference, wc);
    }
  } // readData