Exemplo n.º 1
0
  void ReceiveFile() throws Exception {
    String fileName;

    fileName = din.readUTF();

    if (fileName != null && !fileName.equals("NOFILE")) {
      System.out.println("Receiving File");
      File f =
          new File(
              System.getProperty("user.home")
                  + "/Desktop"
                  + "/"
                  + fileName.substring(fileName.lastIndexOf("/") + 1));
      System.out.println(f.toString());
      f.createNewFile();
      FileOutputStream fout = new FileOutputStream(f);
      int ch;
      String temp;
      do {
        temp = din.readUTF();
        ch = Integer.parseInt(temp);
        if (ch != -1) {
          fout.write(ch);
        }
      } while (ch != -1);
      System.out.println("Received File : " + fileName);
      fout.close();
    } else {
    }
  }
Exemplo n.º 2
0
  protected void read(DataInputStream s) {
    try {
      ref = new WeakReference<DataBuffer>(this, Nd4j.bufferRefQueue());
      referencing = Collections.synchronizedSet(new HashSet<String>());
      dirty = new AtomicBoolean(false);
      allocationMode = AllocationMode.valueOf(s.readUTF());
      length = s.readInt();
      Type t = Type.valueOf(s.readUTF());
      if (t == Type.DOUBLE) {
        if (allocationMode == AllocationMode.HEAP) {
          if (this.dataType() == Type.FLOAT) { // DataBuffer type
            // double -> float
            floatData = new float[length()];
          } else if (this.dataType() == Type.DOUBLE) {
            // double -> double
            doubleData = new double[length()];
          } else {
            // double -> int
            intData = new int[length()];
          }
          for (int i = 0; i < length(); i++) {
            put(i, s.readDouble());
          }
        } else {
          wrappedBuffer = ByteBuffer.allocateDirect(length() * getElementSize());
          wrappedBuffer.order(ByteOrder.nativeOrder());
          for (int i = 0; i < length(); i++) {
            put(i, s.readDouble());
          }
        }
      } else {
        if (allocationMode == AllocationMode.HEAP) {
          if (this.dataType() == Type.FLOAT) { // DataBuffer type
            // float -> float
            floatData = new float[length()];
          } else if (this.dataType() == Type.DOUBLE) {
            // float -> double
            doubleData = new double[length()];
          } else {
            // float-> int
            intData = new int[length()];
          }
          for (int i = 0; i < length(); i++) {
            put(i, s.readFloat());
          }
        } else {
          wrappedBuffer = ByteBuffer.allocateDirect(length() * getElementSize());
          wrappedBuffer.order(ByteOrder.nativeOrder());
          for (int i = 0; i < length(); i++) {
            put(i, s.readFloat());
          }
        }
      }

    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
    public TreeRequest deserialize(DataInputStream dis, int version) throws IOException {
      String sessId = dis.readUTF();
      InetAddress endpoint = CompactEndpointSerializationHelper.deserialize(dis);
      CFPair cfpair = new CFPair(dis.readUTF(), dis.readUTF());
      Range range;
      if (version > MessagingService.VERSION_07)
        range = (Range) AbstractBounds.serializer().deserialize(dis);
      else
        range =
            new Range(
                StorageService.getPartitioner().getMinimumToken(),
                StorageService.getPartitioner().getMinimumToken());

      return new TreeRequest(sessId, endpoint, range, cfpair);
    }
Exemplo n.º 4
0
 public void run() {
   while (flag) {
     try {
       String msg = din.readUTF().trim();
       if (msg.startsWith("<#NICK_NAME#>")) {
         this.nick_name(msg);
       } else if (msg.startsWith("<#CLIENT_LEAVE#>")) {
         this.client_leave(msg);
       } else if (msg.startsWith("<#CHALLENGE#>")) {
         this.challenge(msg);
       } else if (msg.startsWith("<#AGREE#>")) {
         this.agree(msg);
       } else if (msg.startsWith("<#DISAGREE#>")) {
         this.disagree(msg);
       } else if (msg.startsWith("<#BUSY#>")) {
         this.busy(msg);
       } else if (msg.startsWith("<#MOVE#>")) {
         this.move(msg);
       } else if (msg.startsWith("<#SURRENDER#>")) {
         this.surrender(msg);
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
Exemplo n.º 5
0
  public void run() throws IOException {
    ServerSocket server = new ServerSocket(this.portNumber);
    this.socket = server.accept();
    this.socket.setTcpNoDelay(true);
    server.close();

    DataInputStream in = new DataInputStream(this.socket.getInputStream());
    final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
    while (true) {
      final String className = in.readUTF();
      Thread thread =
          new Thread() {
            public void run() {
              try {
                loadAndRun(className);
                out.writeBoolean(true);
                System.err.println(VerifyTests.class.getName());
                System.out.println(VerifyTests.class.getName());
              } catch (Throwable e) {
                e.printStackTrace();
                try {
                  System.err.println(VerifyTests.class.getName());
                  System.out.println(VerifyTests.class.getName());
                  out.writeBoolean(false);
                } catch (IOException e1) {
                  // ignore
                }
              }
            }
          };
      thread.start();
    }
  }
Exemplo n.º 6
0
 public void run() {
   try {
     boolean connected = true;
     System.out.println("a client has connected!");
     dis = new DataInputStream(s.getInputStream());
     dos = new DataOutputStream(s.getOutputStream());
     while (connected) {
       int cid = clients.indexOf(this) + 1;
       try {
         String str = dis.readUTF();
         System.out.println(str);
         for (int i = 0; i < clients.size(); i++) {
           clients.get(i).dos.writeUTF("Client" + cid + ":" + str);
         }
       } catch (IOException e) {
         connected = false;
       }
     }
     dis.close();
     dos.close();
     s.close();
     clients.remove(this);
     System.out.println("a client is qiut!");
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
  /** Method declaration */
  public void run() {

    Channel c = init();

    if (c != null) {
      try {
        while (true) {
          String sql = mInput.readUTF();

          mServer.trace(mThread + ":" + sql);

          if (sql == null) {
            break;
          }

          write(mDatabase.execute(sql, c).getBytes());
        }
      } catch (Exception e) {
      }
    }

    try {
      mSocket.close();
    } catch (IOException e) {
    }

    if (mDatabase.isShutdown()) {
      System.out.println("The database is shutdown");
      System.exit(0);
    }
  }
Exemplo n.º 8
0
    public void run() {
      String name = "";

      try {
        name = in.readUTF();
        send(name + "님이 입장하셨습니다.");

        clients.put(name, out);
        System.out.println("현재 접속자수는 " + clients.size() + "입니다");

        while (in != null) {
          send(in.readUTF());
        }
      } catch (IOException e) {

      } finally {
        System.out.println(name + "님이 퇴장하셨습니다.");
        send(name + "님이 퇴장하셨습니다.");
        clients.remove(name);
      }
    }
Exemplo n.º 9
0
    public void run() {
      try {

        DataInputStream dis = new DataInputStream(s.getInputStream());
        String str = dis.readUTF();
        while (str != null && str.length() != 0) {
          System.out.println(str);
          for (Iterator it = cClient.iterator(); it.hasNext(); ) {
            ClientConn cc = (ClientConn) it.next();
            if (this != cc) {
              cc.send(str);
            }
          }
          str = dis.readUTF();
          // send(str);
        }
        this.dispose();
      } catch (Exception e) {
        System.out.println("client quit");
        this.dispose();
      }
    }
Exemplo n.º 10
0
  private void readOldState(DataInputStream dis) throws IOException, TeamException {
    int repoSize = dis.readInt();
    boolean version1 = false;
    if (repoSize == STATE_FILE_VERSION_1) {
      version1 = true;
      repoSize = dis.readInt();
    }
    for (int i = 0; i < repoSize; i++) {
      ICVSRepositoryLocation root = KnownRepositories.getInstance().getRepository(dis.readUTF());
      RepositoryRoot repoRoot = getRepositoryRootFor(root);

      // read branch tags associated with this root
      int tagsSize = dis.readInt();
      CVSTag[] branchTags = new CVSTag[tagsSize];
      for (int j = 0; j < tagsSize; j++) {
        String tagName = dis.readUTF();
        int tagType = dis.readInt();
        branchTags[j] = new CVSTag(tagName, tagType);
      }
      // Ignore the branch tags since they are handled differently now
      // addBranchTags(root, branchTags);

      // read the number of projects for this root that have version tags
      int projSize = dis.readInt();
      if (projSize > 0) {
        for (int j = 0; j < projSize; j++) {
          String name = dis.readUTF();
          Set tagSet = new HashSet();
          int numTags = dis.readInt();
          for (int k = 0; k < numTags; k++) {
            tagSet.add(new CVSTag(dis.readUTF(), CVSTag.VERSION));
          }
          CVSTag[] tags = (CVSTag[]) tagSet.toArray(new CVSTag[tagSet.size()]);
          repoRoot.addTags(name, tags);
        }
      }
      // read the auto refresh filenames for this project
      if (version1) {
        try {
          projSize = dis.readInt();
          if (projSize > 0) {
            for (int j = 0; j < projSize; j++) {
              String name = dis.readUTF();
              Set filenames = new HashSet();
              int numFilenames = dis.readInt();
              for (int k = 0; k < numFilenames; k++) {
                filenames.add(name + "/" + dis.readUTF()); // $NON-NLS-1$
              }
              repoRoot.setAutoRefreshFiles(
                  name, (String[]) filenames.toArray(new String[filenames.size()]));
            }
          }
        } catch (EOFException e) {
          // auto refresh files are not persisted, continue and save them next time.
        }
      }
      broadcastRepositoryChange(repoRoot);
    }
  }
  void SendFile() throws Exception {

    String filename;
    System.out.print("Enter File Name :");
    filename = br.readLine();

    File f = new File(filename);
    if (!f.exists()) {
      System.out.println("File not Exists...");
      dout.writeUTF("File not found");
      return;
    }

    dout.writeUTF(filename);

    String msgFromServer = din.readUTF();
    if (msgFromServer.compareTo("File Already Exists") == 0) {
      String Option;
      System.out.println("File Already Exists. Want to OverWrite (Y/N) ?");
      Option = br.readLine();
      if (Option == "Y") {
        dout.writeUTF("Y");
      } else {
        dout.writeUTF("N");
        return;
      }
    }

    System.out.println("Sending File ...");
    FileInputStream fin = new FileInputStream(f);
    int ch;
    do {
      ch = fin.read();
      dout.writeUTF(String.valueOf(ch));
    } while (ch != -1);
    fin.close();
    System.out.println(din.readUTF());
  }
Exemplo n.º 12
0
  /**
   * Read a constant from the constant pool.
   *
   * @param in The stream from which to read.
   * @return The constant.
   * @exception IOException If an error occurs while reading.
   */
  Constant readConstant(DataInputStream in) throws IOException {
    int tag = in.readUnsignedByte();
    Object value;

    switch (tag) {
      case Constant.CLASS:
      case Constant.STRING:
      case Constant.METHOD_TYPE: // @since 1.8
        value = Integer.valueOf(in.readUnsignedShort());
        break;
      case Constant.FIELD_REF:
      case Constant.METHOD_REF:
      case Constant.INTERFACE_METHOD_REF:
      case Constant.NAME_AND_TYPE:
      case Constant.INVOKE_DYNAMIC: // @since 1.8
        value = new int[2];

        ((int[]) value)[0] = in.readUnsignedShort();
        ((int[]) value)[1] = in.readUnsignedShort();
        break;
      case Constant.INTEGER:
        value = Integer.valueOf(in.readInt());
        break;
      case Constant.FLOAT:
        value = Float.valueOf(in.readFloat());
        break;
      case Constant.LONG:
        // Longs take up 2 constant pool entries.
        value = Long.valueOf(in.readLong());
        break;
      case Constant.DOUBLE:
        // Doubles take up 2 constant pool entries.
        value = Double.valueOf(in.readDouble());
        break;
      case Constant.UTF8:
        value = in.readUTF();
        break;
      case Constant.METHOD_HANDLE: // @since 1.8
        value = new int[2];

        ((int[]) value)[0] = in.readUnsignedByte();
        ((int[]) value)[1] = in.readUnsignedShort();
        break;
      default:
        throw new ClassFormatError("Invalid constant tag: " + tag);
    }

    return new Constant(tag, value);
  }
Exemplo n.º 13
0
  private void processResponse(DataInputStream in) throws IOException {
    long requestId = in.readLong();
    Request r = requests.remove(requestId);

    if (r == null) {
      throw new IllegalStateException(
          "Request " + requestId + " is unknown (last request generated was " + nextRequest.get());
    }

    Object o = null;
    if (in.readBoolean()) {
      o = serializerFor(classForName(in.readUTF()), r.getResultDeclaredType()).deserialize(in);
    }
    r.set(o);
  }
  /**
   * Method declaration
   *
   * @return
   */
  private Channel init() {

    try {
      mSocket.setTcpNoDelay(true);

      mInput = new DataInputStream(new BufferedInputStream(mSocket.getInputStream()));
      mOutput = new DataOutputStream(new BufferedOutputStream(mSocket.getOutputStream()));

      String user = mInput.readUTF();
      String password = mInput.readUTF();
      Channel c;

      try {
        mServer.trace(mThread + ":trying to connect user " + user);

        return mDatabase.connect(user, password);
      } catch (SQLException e) {
        write(new Result(e.getMessage()).getBytes());
      }
    } catch (Exception e) {
    }

    return null;
  }
  void ReceiveFile() throws Exception {
    String fileName;
    System.out.print("Enter File Name :");
    fileName = br.readLine();
    dout.writeUTF(fileName);
    String msgFromServer = din.readUTF();

    if (msgFromServer.compareTo("File Not Found") == 0) {
      System.out.println("File not found on Server ...");
      return;
    } else if (msgFromServer.compareTo("READY") == 0) {
      System.out.println("Receiving File ...");
      File f = new File(fileName);
      if (f.exists()) {
        String Option;
        System.out.println("File Already Exists. Want to OverWrite (Y/N) ?");
        Option = br.readLine();
        if (Option == "N") {
          dout.flush();
          return;
        }
      }
      FileOutputStream fout = new FileOutputStream(f);
      int ch;
      String temp;
      do {
        temp = din.readUTF();
        ch = Integer.parseInt(temp);
        if (ch != -1) {
          fout.write(ch);
        }
      } while (ch != -1);
      fout.close();
      System.out.println(din.readUTF());
    }
  }
Exemplo n.º 16
0
 static String getContent(File dir, String f) {
   DataInputStream in = null;
   try {
     in = new DataInputStream(new FileInputStream(new File(dir, f)));
     return in.readUTF();
   } catch (IOException ignore) {
   } finally {
     if (in != null) {
       try {
         in.close();
       } catch (IOException ignore) {
       }
     }
   }
   return null;
 }
Exemplo n.º 17
0
  public void inputBinary(DataInputStream dis) throws IOException {
    int ns = dis.readInt();
    for (int i = 0; i < ns; i++) {
      samples.add(dis.readUTF());
    }

    int s = dis.readInt();
    for (int i = 0; i < s; i++) {
      Column c = new Column(dis);
      cols.add(c);
      ids.put(c.id, cols.size() - 1);
      if (i > 0) {
        // if(i % 100 == 0) { System.out.print("."); System.out.flush(); }
        // if(i % 1000 == 0) { System.out.print("(" + i + ")"); System.out.flush(); }
      }
    }
    System.out.println();
  }
Exemplo n.º 18
0
  public Column(DataInputStream dis) throws IOException {
    id = dis.readUTF();
    values = new Vector<Float>();
    int s = dis.readInt();

    int i = 0;
    while (i < s) {
      int c = dis.readInt();

      for (int j = 0; j < c && i < s; j++, i++) {
        values.add(dis.readFloat());
      }

      if (i < s) {
        values.add(null);
        i++;
      }
    }
  }
Exemplo n.º 19
0
  public void run() {

    while (true) {
      try {
        System.out.println(
            "TCP Server waiting for client on port " + serverSocket.getLocalPort() + "...");
        Socket server = serverSocket.accept();
        System.out.println("Just received request from " + server.getRemoteSocketAddress());

        /* parsing a request from socket */
        DataInputStream in = new DataInputStream(server.getInputStream());
        String request = in.readUTF();
        System.out.println("Request: " + request);

        /* handle the request */
        String output = null;
        output = requestHandler(request);
        System.out.print(output);

        /* display dataTable */
        System.out.print("-dataTable--------\n");
        Enumeration<String> key = dataTable.keys();
        while (key.hasMoreElements()) {
          String str = key.nextElement();
          System.out.println(str + ": " + dataTable.get(str));
        }
        System.out.print("------------------\n");

        /* send the result back to the client */
        DataOutputStream out = new DataOutputStream(server.getOutputStream());
        out.writeUTF(output);
        server.close();

      } catch (SocketTimeoutException s) {
        System.out.println("Socket timed out!");
        break;
      } catch (IOException e) {
        e.printStackTrace();
        break;
      }
    }
  }
Exemplo n.º 20
0
  /**
   * Gets the JAR URL of the suite. This is only for the installer.
   *
   * @return URL of the JAR, never null, even in development environments
   */
  public String getJarUrl() {
    RandomAccessStream storage = new RandomAccessStream(classSecurityToken);
    DataInputStream storageStream;

    try {
      storage.connect(getStorageRoot() + Installer.JAR_URL_FILENAME, Connector.READ);

      // convert the JAR URL to UTF8 and write it to storage
      storageStream = storage.openDataInputStream();
      return storageStream.readUTF();
    } catch (Exception e) {
      // old installations did not have JAR URL's
      return "unknown";
    } finally {
      try {
        storage.disconnect();
      } catch (IOException e) {
        // ignore
      }
    }
  }
Exemplo n.º 21
0
  /** Get the settings the Manager saved for the user. */
  private void restoreSettings() {
    ByteArrayInputStream bas;
    DataInputStream dis;
    byte[] data;
    RecordStore settings = null;

    try {
      settings = RecordStore.openRecordStore(GraphicalInstaller.SETTINGS_STORE, false);

      data = settings.getRecord(1);
      if (data != null) {
        bas = new ByteArrayInputStream(data);
        dis = new DataInputStream(bas);
        defaultInstallListUrl = dis.readUTF();
      }

    } catch (RecordStoreException e) {
      if (Logging.REPORT_LEVEL <= Logging.WARNING) {
        Logging.report(
            Logging.WARNING, LogChannels.LC_AMS, "restoreSettings threw a RecordStoreException");
      }
    } catch (IOException e) {
      if (Logging.REPORT_LEVEL <= Logging.WARNING) {
        Logging.report(Logging.WARNING, LogChannels.LC_AMS, "restoreSettings threw an IOException");
      }
    } finally {
      if (settings != null) {
        try {
          settings.closeRecordStore();
        } catch (RecordStoreException e) {
          if (Logging.REPORT_LEVEL <= Logging.WARNING) {
            Logging.report(
                Logging.WARNING,
                LogChannels.LC_AMS,
                "closeRecordStore threw a RecordStoreException");
          }
        }
      }
    }
  }
  @SuppressWarnings("rawtypes")
  private static Object readObjectFromStream(DataInputStream data, Class curClass)
      throws IOException {
    if (curClass.equals(Boolean.class)) {
      return data.readBoolean();
    } else if (curClass.equals(Byte.class)) {
      return data.readByte();
    } else if (curClass.equals(Integer.class)) {
      return data.readInt();
    } else if (curClass.equals(String.class)) {
      return data.readUTF();
    } else if (curClass.equals(Double.class)) {
      return data.readDouble();
    } else if (curClass.equals(Float.class)) {
      return data.readFloat();
    } else if (curClass.equals(Long.class)) {
      return data.readLong();
    } else if (curClass.equals(Short.class)) {
      return data.readShort();
    }

    return null;
  }
Exemplo n.º 23
0
  /** Method to keep the connection alive with the name server */
  public void run() {
    boolean connected = false;
    int ticket = 0;
    int serial = -1;
    int time = 1000;

    DatagramPacket inPack = new DatagramPacket(new byte[1024], 1024);
    DatagramPacket outPack = new DatagramPacket(new byte[1024], 1024);

    ByteArrayOutputStream outBuf = new ByteArrayOutputStream();
    DataInputStream inData;
    DataOutputStream outData = new DataOutputStream(outBuf);

    while (running) {
      if (!connected) { // Thoust ought Register thine self
        try {
          outBuf.reset();
          outData.writeByte(0);
          outData.writeUTF(userName);
          outData.writeInt(portNum);
          outData.flush();
          outPack.setData(outBuf.toByteArray());
          nameServer.send(outPack);
        } catch (IOException e) {
          System.err.println("LeetActive: " + e);
        }
      } else { // Thoust ought Renew thine self
        try {
          outBuf.reset();
          outData.writeByte(2);
          outData.writeInt(ticket);
          outData.flush();
          outPack.setData(outBuf.toByteArray());
          nameServer.send(outPack);
        } catch (IOException e) {
          System.err.println(e);
        }
      }

      // Now we will receive a packet...
      try {
        nameServer.receive(inPack);
        inData = new DataInputStream(new ByteArrayInputStream(inPack.getData()));

        byte type = inData.readByte();

        if (type == 1) { // Twas a ticket packet
          try {
            ticket = inData.readInt();
            if (ticket > -1) { // Make sure its not evil
              connected = true;
            } else {
              connected = false;
            }
            time = inData.readInt();
          } catch (IOException e) {
            System.err.println(e);
          }
        }

        if (type == 5) { // Twas an update packet
          try {
            int s = inData.readInt();
            if (s > serial) { // Make sure its not old
              serial = s;
              int size = inData.readInt();
              ArrayList newList = new ArrayList(size);

              for (int x = 0; x < size; x++) {
                newList.add(
                    new String(
                        "" + inData.readUTF() + "@" + inData.readUTF() + ":" + inData.readInt()));
              }

              if (!newList.equals(hostList)) {
                hostList = newList;
                updated = true;
              }
            }
          } catch (IOException e) {
            System.err.println(e);
          }
        }
      } catch (SocketTimeoutException e) { // Server hates you
        connected = false;
        System.err.println(e);
      } catch (IOException e) {
        System.err.println(e);
      }

      try { // Take a nap
        sleep(time / 4);
      } catch (InterruptedException e) {
      }
    }
  }
Exemplo n.º 24
0
  /** @param args */
  public static void main(String[] args) {

    try {

      // force dot as decimal separator
      Locale.setDefault(new Locale("en", "US"));

      // Get current time
      long start = System.currentTimeMillis();

      RinexNavigation navigationIn =
          new RinexNavigation(RinexNavigation.IGN_NAVIGATION_HOURLY_ZIM2);

      FileInputStream fis = new FileInputStream(".\\data\\aphemeris.dat");
      // FileInputStream fis = new FileInputStream(".\\data\\assistnow.dat");
      DataInputStream dis = new DataInputStream(fis);
      String msg = null;
      try {
        msg = dis.readUTF();
        while (msg != null) {
          System.out.println("Msg:[" + msg + "]");
          if (msg.equalsIgnoreCase(Streamable.MESSAGE_OBSERVATIONS)) {
            Observations o = new Observations(dis, false);

          } else if (msg.equalsIgnoreCase(Streamable.MESSAGE_EPHEMERIS)) {
            EphGps eph1 = new EphGps(dis, false);
            System.out.println(
                "found sat" + eph1.getSatID() + " time:" + eph1.getRefTime().getGpsTime());

            EphGps eph2 =
                navigationIn.findEph(
                    eph1.getRefTime().getMsec(), eph1.getSatID(), eph1.getSatType());

            // Compare
            if (eph2 != null) {
              double ms = eph1.getRefTime().getGpsTime() - eph2.getRefTime().getGpsTime();
              System.out.println(" time dif:" + (ms / 1000) + "s " + (ms % 1000) + "ms");
              ;
              equalDouble("Af0", eph1.getAf0(), eph2.getAf0());
              equalDouble("Af1", eph1.getAf1(), eph2.getAf1());
              equalDouble("Af2", eph1.getAf2(), eph2.getAf2());
              equalDouble("Cic", eph1.getCic(), eph2.getCic());
              equalDouble("Cis", eph1.getCis(), eph2.getCis());
              equalDouble("Crc", eph1.getCrc(), eph2.getCrc());
              equalDouble("Crs", eph1.getCrs(), eph2.getCrs());
              equalDouble("Cuc", eph1.getCuc(), eph2.getCuc());
              equalDouble("Cus", eph1.getCus(), eph2.getCus());
              equalDouble("DeltaN", eph1.getDeltaN(), eph2.getDeltaN());
              equalDouble("E", eph1.getE(), eph2.getE());
              equalDouble("FitInt", eph1.getFitInt(), eph2.getFitInt());
              equalDouble("I0", eph1.getI0(), eph2.getI0());
              equalDouble("iDot", eph1.getiDot(), eph2.getiDot());
              equalDouble("M0", eph1.getM0(), eph2.getM0());
              equalDouble("Omega", eph1.getOmega(), eph2.getOmega());
              equalDouble("Omega0", eph1.getOmega0(), eph2.getOmega0());
              equalDouble("OmegaDot", eph1.getOmegaDot(), eph2.getOmegaDot());
              equalDouble("RootA", eph1.getRootA(), eph2.getRootA());
              equalDouble("Tgd", eph1.getTgd(), eph2.getTgd());
              equalDouble("Toc", eph1.getToc(), eph2.getToc());
              equalDouble("Toe", eph1.getToe(), eph2.getToe());
              equalDouble("Iodc", eph1.getIodc(), eph2.getIodc());
              equalDouble("Iode", eph1.getIode(), eph2.getIode());
              equalDouble("L2Code", eph1.getL2Code(), eph2.getL2Code());
              equalDouble("L2Flag", eph1.getL2Flag(), eph2.getL2Flag());
              equalDouble("SvAccur", eph1.getSvAccur(), eph2.getSvAccur());
              equalDouble("SvHealth", eph1.getSvHealth(), eph2.getSvHealth());

            } else {
              System.out.println(
                  "EPH 2 not found for " + eph1.getSatID() + " at " + eph1.getRefTime());
            }

          } else if (msg.equalsIgnoreCase(Streamable.MESSAGE_OBSERVATIONS_SET)) {
            ObservationSet eps = new ObservationSet(dis, false);
            // nothing to do with ?
          } else if (msg.equalsIgnoreCase(Streamable.MESSAGE_IONO)) {
            IonoGps iono = new IonoGps(dis, false);
            // addIonospheric(iono);
          } else if (msg.equalsIgnoreCase(Streamable.MESSAGE_COORDINATES)) {
            Coordinates c = Coordinates.readFromStream(dis, false);
            // setDefinedPosition(c);

          } else {
            System.out.println("Unknow Msg:[" + msg + "]");
          }

          msg = dis.readUTF();
        }
      } catch (EOFException eof) {
        // ok
      }
      fis.close();

      try {
        navigationIn.release(true, 10000);
      } catch (InterruptedException ie) {
        ie.printStackTrace();
      }

      // Get and display elapsed time
      int elapsedTimeSec = (int) Math.floor((System.currentTimeMillis() - start) / 1000);
      int elapsedTimeMillisec =
          (int) ((System.currentTimeMillis() - start) - elapsedTimeSec * 1000);
      System.out.println(
          "\nElapsed time (read + proc + display + write): "
              + elapsedTimeSec
              + " seconds "
              + elapsedTimeMillisec
              + " milliseconds.");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 25
0
  /**
   * Gets properites from a symbolically named installed package. The properties are the attributes
   * in the application descriptor and JAR Manifest.
   */
  private void getPropertiesFromStorage() {
    RandomAccessStream myStorage;
    int size;
    byte[] buffer;
    InputStream is;
    DataInputStream dis;
    String jadEncoding = null;

    myStorage = new RandomAccessStream(classSecurityToken);

    // Get the JAD encoding, if the server provided one
    try {
      myStorage.connect(storageRoot + Installer.JAD_ENCODING_FILENAME, Connector.READ);
      try {
        // convert the JAD encoding to UTF8 and write it to storage
        dis = myStorage.openDataInputStream();
        try {
          jadEncoding = dis.readUTF();
        } finally {
          dis.close();
        }
      } finally {
        myStorage.disconnect();
      }
    } catch (IOException e) {
      // servers can choose the default encoding by not providing one
    }

    // Load .jad file
    bufferedJadProps = new JadProperties();
    try {
      myStorage.connect(storageRoot + Installer.JAD_FILENAME, Connector.READ);
      try {
        size = myStorage.getSizeOf();
        buffer = new byte[size];
        dis = myStorage.openDataInputStream();
        try {
          dis.readFully(buffer);
          is = new ByteArrayInputStream(buffer);

          bufferedJadProps.load(is, jadEncoding);

          buffer = null;
          is = null;
        } finally {
          dis.close();
        }
      } finally {
        myStorage.disconnect();
      }
    } catch (IOException e) {
      // Jar only install
    }

    try {
      // Get Manifest file so we can buffer it
      myStorage.connect(storageRoot + Installer.MANIFEST_FILENAME, Connector.READ);
      try {
        size = myStorage.getSizeOf();
        buffer = new byte[size];
        dis = myStorage.openDataInputStream();
        try {
          dis.readFully(buffer);
          is = new ByteArrayInputStream(buffer);

          bufferedJarProps = new ManifestProperties();
          bufferedJarProps.load(is);

          buffer = null;
          is = null;
        } finally {
          dis.close();
        }
      } finally {
        myStorage.disconnect();
      }
    } catch (IOException e) {
      // ignore
    }
  }
Exemplo n.º 26
0
  /**
   * Process and loop until told to stop. A callback_done will stop the loop and will return a
   * result. Otherwise null is returned.
   */
  public Object run() throws CommandException {
    Object result = null;
    boolean shutdown = false;
    boolean closeWhenDone = true;
    Commands.ValueObject valueObject =
        new Commands.ValueObject(); // Working value object so not continually recreated.
    InvokableValueSender valueSender =
        new InvokableValueSender(); // Working valuesender so not continually recreated.
    try {
      boolean doLoop = true;

      /**
       * Note: In the cases below you will see a lot of finally clauses that null variables out.
       * This is because this is a long running loop, and variables declared within blocks are not
       * garbage collected until the method is terminated, so these variables once set would never
       * be GC'd. The nulling at the end of the case makes sure that any of those objects set are
       * now available for garbage collection when necessary.
       */
      while (doLoop && isConnected()) {
        byte cmd = 0;
        try {
          if (LINUX_1_3) socket.setSoTimeout(1000); // Linux 1.3 bug, see comment on LINUX_1_3
          cmd = in.readByte();
          if (LINUX_1_3 && isConnected())
            socket.setSoTimeout(0); // Linux 1.3 bug, see comment on LINUX_1_3
        } catch (InterruptedIOException e) {
          continue; // Timeout, try again
        }
        switch (cmd) {
          case Commands.QUIT_CONNECTION:
            doLoop = false;
            break; // Close this connection

          case Commands.TERMINATE_SERVER:
            doLoop = false;
            shutdown = true; // Shutdown everything
            break;

          case Commands.GET_CLASS:
            String className = in.readUTF();
            Class aClass = null;
            Class superClass = null;
            String superClassName = null;
            boolean added = false;
            try {
              aClass =
                  Class.forName(
                      className); // Turns out using JNI format for array type will work fine.

              added = server.getIdentityID(aClass, valueObject);
              boolean isInterface = aClass.isInterface();
              boolean isAbstract = java.lang.reflect.Modifier.isAbstract(aClass.getModifiers());
              superClass = aClass.getSuperclass();
              superClassName = (superClass != null) ? superClass.getName() : ""; // $NON-NLS-1$
              out.writeByte(Commands.GET_CLASS_RETURN);
              out.writeInt(valueObject.objectID);
              out.writeBoolean(isInterface);
              out.writeBoolean(isAbstract);
              out.writeUTF(superClassName);
              out.flush();
            } catch (ClassNotFoundException e) {
              valueObject.set();
              Commands.sendErrorCommand(out, Commands.GET_CLASS_NOT_FOUND, valueObject);
            } catch (ExceptionInInitializerError e) {
              sendException(e.getException(), valueObject, out);
            } catch (LinkageError e) {
              sendException(e, valueObject, out);
            } catch (Throwable e) {
              // Something bad, did we add a class? If we did remove it from the table.
              if (added) server.removeObject(server.getObject(valueObject.objectID));
              throw e;
            } finally {
              // clear out for GC to work.
              className = null;
              aClass = null;
              superClass = null;
              superClassName = null;
              valueObject.set();
            }
            break;

          case Commands.GET_CLASS_FROM_ID:
            int classID = in.readInt();
            try {
              aClass = (Class) server.getObject(classID);
              boolean isInterface = aClass.isInterface();
              boolean isAbstract = java.lang.reflect.Modifier.isAbstract(aClass.getModifiers());
              superClass = aClass.getSuperclass();
              superClassName = (superClass != null) ? superClass.getName() : ""; // $NON-NLS-1$
              out.writeByte(Commands.GET_CLASS_ID_RETURN);
              out.writeUTF(aClass.getName());
              out.writeBoolean(isInterface);
              out.writeBoolean(isAbstract);
              out.writeUTF(superClassName);
              out.flush();
            } catch (ClassCastException e) {
              valueObject.set();
              Commands.sendErrorCommand(out, Commands.CLASS_CAST_EXCEPTION, valueObject);
            } finally {
              // clear out for GC to work.
              aClass = null;
              superClass = null;
              superClassName = null;
              valueObject.set();
            }
            break;

          case Commands.GET_OBJECT_DATA:
            int objectID = in.readInt();
            Object anObject = null;
            try {
              anObject = server.getObject(objectID);
              valueObject.setObjectID(objectID, server.getIdentityID(anObject.getClass()));
              Commands.writeValue(out, valueObject, true);
            } catch (ClassCastException e) {
              valueObject.set();
              Commands.sendErrorCommand(out, Commands.CLASS_CAST_EXCEPTION, valueObject);
            } finally {
              anObject = null; // Clear out for GC to work
              valueObject.set();
            }
            break;

          case Commands.RELEASE_OBJECT:
            int id = in.readInt();
            server.removeObject(server.getObject(id));
            break;

          case Commands.NEW_INIT_STRING:
            classID = in.readInt(); // ID Of class to do new upon.
            String initString = in.readUTF(); // The init string.
            Object newValue = null;
            Class theClass = null;
            try {
              theClass = (Class) server.getObject(classID);
              if (theClass == null) {
                // The class wasn't found. So imply ClassNotFound exception.
                throw new ClassNotFoundException();
              }

              InitializationStringParser parser = null;
              try {
                parser = InitializationStringParser.createParser(initString);
                newValue = parser.evaluate();
                boolean primitive = parser.isPrimitive();
                // If expected class is Void.TYPE, that means don't test the type of the result
                // to verify if correct type, just return what it really is.
                if (theClass != Void.TYPE && primitive != theClass.isPrimitive()) {
                  valueObject.set();
                  Commands.sendErrorCommand(out, Commands.CLASS_CAST_EXCEPTION, valueObject);
                  continue; // Goto next command.
                }
                if (primitive) {
                  try {
                    // Need to do special tests for compatibility and assignment.
                    sendObject(
                        newValue,
                        classID != Commands.VOID_TYPE
                            ? classID
                            : server.getIdentityID(parser.getExpectedType()),
                        valueObject,
                        out,
                        true); // This will make sure it goes out as the correct primitive type
                  } catch (ClassCastException e) {
                    // The returned type is not of the correct type for what is expected.
                    valueObject.set();
                    Commands.sendErrorCommand(out, Commands.CLASS_CAST_EXCEPTION, valueObject);
                    continue; // Goto next command
                  }
                } else {
                  if (newValue != null) {
                    // Test to see if they are compatible. (Null can be assigned to any object,
                    // so that is why it was tested out above).
                    // If expected class is Void.TYPE, that means don't test the type of the result
                    // to verify if correct type, just return what it really is.
                    if (theClass != Void.TYPE && !theClass.isInstance(newValue)) {
                      // The returned type is not of the correct type for what is expected.
                      valueObject.set();
                      Commands.sendErrorCommand(out, Commands.CLASS_CAST_EXCEPTION, valueObject);
                      continue; // Goto next command
                    }
                  }
                  sendObject(
                      newValue, NOT_A_PRIMITIVE, valueObject, out, true); // Send out as an object.
                }
              } catch (InitializationStringEvaluationException e) {
                if (e instanceof EvaluationException) {
                  // Want to return the real exception.
                  sendException(e.getOriginalException(), valueObject, out);
                } else {
                  // Couldn't be evaluated, return an error for this.
                  setExceptionIntoValue(e.getOriginalException(), valueObject);
                  Commands.sendErrorCommand(out, Commands.CANNOT_EVALUATE_STRING, valueObject);
                }
              } finally {
                parser = null; // Clear out for GC to work
              }
            } catch (Throwable e) {
              sendException(e, valueObject, out);
            } finally {
              // Clear out for GC to work
              initString = null;
              theClass = null;
              newValue = null;
              valueObject.set();
            }
            break;

          case Commands.INVOKE:
            Object target = null;
            Object[] parms = null;
            Class returnType = null;
            java.lang.reflect.Method aMethod = null;
            try {
              int methodID = in.readInt(); // ID of method to invoke
              aMethod = (java.lang.reflect.Method) server.getObject(methodID); // Method to invoke
              Commands.readValue(in, valueObject);
              target = getInvokableObject(valueObject);
              Commands.readValue(in, valueObject);
              if (valueObject.type == Commands.ARRAY_IDS) {
                // It is an array containing IDs, as it normally would be.
                valueSender.initialize(valueObject);
                Commands.readArray(in, valueObject.anInt, valueSender, valueObject, false);
                parms = (Object[]) valueSender.getArray();
              } else {
                // It is all objects or null, so it should be an Object[] or null. If not, then this
                // is an error.
                parms = (Object[]) valueObject.anObject;
              }

              if (!aMethod.isAccessible())
                aMethod.setAccessible(
                    true); // We will allow all to occur. Let access control be handled by IDE and
                           // compiler.
              newValue = aMethod.invoke(target, parms);
              returnType = aMethod.getReturnType();
              if (returnType.isPrimitive()) {
                int returnTypeID = server.getIdentityID(returnType);
                // Need to tell sendObject the correct primitive type.
                sendObject(newValue, returnTypeID, valueObject, out, true);

              } else {
                sendObject(
                    newValue,
                    NOT_A_PRIMITIVE,
                    valueObject,
                    out,
                    true); // Just send the object back. sendObject knows how to iterpret the type
              }
            } catch (CommandException e) {
              throw e; // Throw it again. These we don't want to come up as an exception proxy.
                       // These should end the thread.
            } catch (java.lang.reflect.InvocationTargetException e) {
              // This is a wrappered exception. Return the wrappered one so it looks like
              // it was the real one. (Sometimes the method being invoked is on a
              // java.lang.reflect.Constructor.newInstance,
              // which in turn is an InvocationTargetException, so we will go until we don't have an
              // InvocationTargetException.
              Throwable t = e;
              do {
                t = ((java.lang.reflect.InvocationTargetException) t).getTargetException();
              } while (t instanceof java.lang.reflect.InvocationTargetException);
              sendException(t, valueObject, out);
            } catch (Throwable e) {
              sendException(e, valueObject, out); // Turn it into a exception proxy on the client.
            } finally {
              // Clear out for GC to work
              valueObject.set();
              parms = null;
              target = null;
              aMethod = null;
              returnType = null;
              newValue = null;
              valueSender.clear();
            }
            break;

          case Commands.INVOKE_WITH_METHOD_PASSED:
            aClass = null;
            String methodName = null;
            Class[] parmTypes = null;
            target = null;
            parms = null;
            returnType = null;
            aMethod = null;

            try {
              Commands.readValue(in, valueObject);
              aClass = (Class) getInvokableObject(valueObject); // The class that has the method.
              methodName = in.readUTF();
              Commands.readValue(in, valueObject);
              if (valueObject.type == Commands.ARRAY_IDS) {
                // It is an array containing IDs, as it normally would be.
                valueSender.initialize(valueObject);
                Commands.readArray(in, valueObject.anInt, valueSender, valueObject, false);
                parmTypes = (Class[]) valueSender.getArray();
              } else {
                // It null, so it should be an null. If not, then this is an error.
                parmTypes = null;
              }
              aMethod = aClass.getMethod(methodName, parmTypes);

              // Now we get the info for the invocation of the method and execute it.
              Commands.readValue(in, valueObject);
              target = getInvokableObject(valueObject);
              Commands.readValue(in, valueObject);
              if (valueObject.type == Commands.ARRAY_IDS) {
                // It is an array containing IDs, as it normally would be.
                valueSender.initialize(valueObject);
                Commands.readArray(in, valueObject.anInt, valueSender, valueObject, false);
                parms = (Object[]) valueSender.getArray();
              } else {
                // It is all objects or null, so it should be an Object[] or null. If not, then this
                // is an error.
                parms = (Object[]) valueObject.anObject;
              }

              if (!aMethod.isAccessible())
                aMethod.setAccessible(
                    true); // We will allow all to occur. Let access control be handled by IDE and
                           // compiler.
              newValue = aMethod.invoke(target, parms);
              returnType = aMethod.getReturnType();
              if (returnType.isPrimitive()) {
                int returnTypeID = server.getIdentityID(returnType);
                // Need to tell sendObject the correct primitive type.
                sendObject(newValue, returnTypeID, valueObject, out, true);

              } else {
                sendObject(
                    newValue,
                    NOT_A_PRIMITIVE,
                    valueObject,
                    out,
                    true); // Just send the object back. sendObject knows how to iterpret the type
              }
            } catch (CommandException e) {
              throw e; // Throw it again. These we don't want to come up as an exception proxy.
                       // These should end the thread.
            } catch (java.lang.reflect.InvocationTargetException e) {
              // This is a wrappered exception. Return the wrappered one so it looks like
              // it was the real one. (Sometimes the method being invoked is on a
              // java.lang.reflect.Constructor.newInstance,
              // which in turn is an InvocationTargetException, so we will go until we don't have an
              // InvocationTargetException.
              Throwable t = e;
              do {
                t = ((java.lang.reflect.InvocationTargetException) t).getTargetException();
              } while (t instanceof java.lang.reflect.InvocationTargetException);
              sendException(t, valueObject, out);

            } catch (Throwable e) {
              sendException(e, valueObject, out); // Turn it into a exception proxy on the client.
            } finally {
              aClass = null;
              methodName = null;
              parmTypes = null;
              // Clear out for GC to work
              valueObject.set();
              parms = null;
              target = null;
              aMethod = null;
              returnType = null;
              newValue = null;
              valueSender.clear();
            }
            break;

          case Commands.GET_ARRAY_CONTENTS:
            try {
              target = server.getObject(in.readInt()); // Array to get the ids for.
              valueObject.setArrayIDS(
                  new ArrayContentsRetriever(target),
                  Array.getLength(target),
                  Commands.OBJECT_CLASS);
              Commands.writeValue(out, valueObject, true); // Write it back as a value command.
            } catch (CommandException e) {
              throw e; // Throw it again. These we don't want to come up as an exception proxy.
                       // These should end the thread.
            } catch (Throwable e) {
              sendException(e, valueObject, out); // Turn it into a exception proxy on the client.
            } finally {
              target = null;
              valueObject.set();
            }
            break;

          case Commands.CALLBACK_DONE:
            try {
              if (connectionThread != null) {
                valueObject.set();
                Commands.sendErrorCommand(out, Commands.UNKNOWN_COMMAND_SENT, valueObject);
              } else {
                try {
                  Commands.readBackValue(in, valueObject, Commands.NO_TYPE_CHECK);
                  if (valueObject.type == Commands.ARRAY_IDS) {
                    // It is an array containing IDs, as it normally would be.
                    valueSender.initialize(valueObject);
                    Commands.readArray(in, valueObject.anInt, valueSender, valueObject, false);
                    result = valueSender.getArray();
                  } else {
                    result = getInvokableObject(valueObject);
                  }
                  doLoop = false; // We need to terminate and return result
                  closeWhenDone = false; // Don't close, we will continue.
                } catch (CommandErrorException e) {
                  // There was an command error on the other side. This means
                  // connection still good, but don't continue the callback processing.
                  doLoop = false; // We need to terminate and return result
                  closeWhenDone = false; // Don't close, we will continue.
                  throw e; // Let it go on out.
                }
              }
            } finally {
              valueObject.set();
              valueSender.clear();
            }
            break;

          case Commands.ERROR:
            try {
              // Got an error command. Don't know what to do but read the
              // value and simply print it out.
              Commands.readValue(in, valueObject);
              result = getInvokableObject(valueObject);
              System.out.println("Error sent to server: Result=" + result); // $NON-NLS-1$
            } finally {
              valueObject.set();
            }
            break;

          case Commands.EXPRESSION_TREE_COMMAND:
            try {
              processExpressionCommand(valueObject, valueSender);
            } finally {
              valueObject.set();
              valueSender.clear();
            }
            break;

          default:
            // Unknown command. We don't know how long it is, so we need to shut the connection
            // down.
            System.err.println("Error: Invalid cmd send to server: Cmd=" + cmd); // $NON-NLS-1$
            doLoop = false;
            closeWhenDone = true;
            break;
        }
      }
    } catch (EOFException e) {
      // This is ok. It means that the connection on the other side was terminated.
      // So just accept this and go down.
    } catch (CommandException e) {
      throw e;
    } catch (SocketException e) {
      if (socket != null)
        throw new UnexpectedExceptionCommandException(
            false, e); // socket null means a valid close request
    } catch (Throwable e) {
      e.printStackTrace();
    } finally {
      if (closeWhenDone) {
        try {
          for (Iterator itr = expressionProcessors.values().iterator(); itr.hasNext(); ) {
            ExpressionProcesserController exp = (ExpressionProcesserController) itr.next();
            exp.close();
          }
        } finally {
          expressionProcessors.clear();
        }

        if (in != null)
          try {
            in.close();
          } catch (Exception e) {
          }
        in = null;
        if (out != null)
          try {
            out.close();
          } catch (Exception e) {
          }
        out = null;
        close();
      }
    }

    if (closeWhenDone && connectionThread != null) server.removeConnectionThread(connectionThread);
    if (shutdown) server.requestShutdown();

    return result;
  }
Exemplo n.º 27
0
  protected void loadFromStorage() {
    DataInputStream inputStream = NvStorage.ReadFileRecord("config", 0);
    try {
      accountIndex = inputStream.readInt();
      showOfflineContacts = inputStream.readBoolean();
      fullscreen = inputStream.readBoolean();
      def_profile = inputStream.readInt();
      smiles = inputStream.readBoolean();
      showTransports = inputStream.readBoolean();
      selfContact = inputStream.readBoolean();
      collapsedGroups = inputStream.readBoolean();
      ignore = inputStream.readBoolean();
      eventComposing = inputStream.readBoolean();

      gmtOffset = inputStream.readInt();
      locOffset = inputStream.readInt();

      autoLogin = inputStream.readBoolean();
      autoJoinConferences = inputStream.readBoolean();

      popupFromMinimized = inputStream.readBoolean();

      notifyBlink = inputStream.readBoolean();
      memMonitor = inputStream.readBoolean();

      font1 = inputStream.readInt();
      font2 = inputStream.readInt();

      autoFocus = inputStream.readBoolean();

      notInListDropLevel = inputStream.readInt();

      storeConfPresence = inputStream.readBoolean();

      capsState = inputStream.readBoolean();

      textWrap = inputStream.readInt();

      loginstatus = inputStream.readInt();

      msgPath = inputStream.readUTF();
      msgLog = inputStream.readBoolean();
      msgLogPresence = inputStream.readBoolean();
      msgLogConfPresence = inputStream.readBoolean();
      msgLogConf = inputStream.readBoolean();
      cp1251 = inputStream.readBoolean();

      autoAwayDelay = inputStream.readInt();

      defGcRoom = inputStream.readUTF();

      altInput = inputStream.readBoolean();

      isbottom = inputStream.readInt();

      confMessageCount = inputStream.readInt();

      newMenu = inputStream.readBoolean();

      lightState = inputStream.readBoolean();

      notifySound = inputStream.readBoolean();

      lastMessages = inputStream.readBoolean();

      setAutoStatusMessage = inputStream.readBoolean();

      autoAwayType = inputStream.readInt();

      autoScroll = inputStream.readBoolean();

      popUps = inputStream.readBoolean();

      showResources = inputStream.readBoolean();

      antispam = inputStream.readBoolean();

      enableVersionOs = inputStream.readBoolean();

      messageLimit = inputStream.readInt();

      lang = inputStream.readUTF();

      eventDelivery = inputStream.readBoolean();

      transliterateFilenames = inputStream.readBoolean();

      rosterStatus = inputStream.readBoolean();

      queryExit = inputStream.readBoolean();

      notifyPicture = inputStream.readBoolean();

      showBalloons = inputStream.readBoolean();

      userKeys = inputStream.readBoolean();

      msglistLimit = inputStream.readInt();

      useTabs = inputStream.readBoolean();

      autoSubscribe = inputStream.readInt();

      useBoldFont = inputStream.readBoolean();

      inputStream.close();
    } catch (Exception e) {
      try {
        if (inputStream != null) inputStream.close();
      } catch (IOException ex) {
      }
    }

    lastProfile = profile = def_profile;
    if (lastProfile == AlertProfile.VIBRA) lastProfile = 0;
    updateTime();
    VirtualList.fullscreen = fullscreen;
    VirtualList.isbottom = isbottom;
    VirtualList.memMonitor = memMonitor;
    VirtualList.showBalloons = showBalloons;
    VirtualList.userKeys = userKeys;
  }