Esempio n. 1
0
 /**
  * As of 0.9.3, expiration MUST be all zeros as it is ignored on readin and the signature will
  * fail. Restored as of 0.9.12, wait several more releases before using.
  *
  * @throws IllegalStateException if was already read in
  */
 public void readBytes(InputStream in) throws DataFormatException, IOException {
   if (_transportStyle != null) throw new IllegalStateException();
   _cost = (short) DataHelper.readLong(in, 1);
   _expiration = DataHelper.readLong(in, 8);
   _transportStyle = DataHelper.readString(in);
   // reduce Object proliferation
   if (_transportStyle.equals("SSU")) _transportStyle = "SSU";
   else if (_transportStyle.equals("NTCP")) _transportStyle = "NTCP";
   DataHelper.readProperties(in, _options);
 }
 @Override
 protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
   try {
     _sessionId = new SessionId();
     _sessionId.readBytes(in);
     int numTunnels = (int) DataHelper.readLong(in, 1);
     _endpoints.clear();
     for (int i = 0; i < numTunnels; i++) {
       // Hash router = new Hash();
       // router.readBytes(in);
       Hash router = Hash.create(in);
       TunnelId tunnel = new TunnelId();
       tunnel.readBytes(in);
       _endpoints.add(new TunnelEndpoint(router, tunnel));
     }
     _end = DataHelper.readDate(in);
   } catch (DataFormatException dfe) {
     throw new I2CPMessageException("Unable to load the message data", dfe);
   }
 }