コード例 #1
0
 public String getLocal() {
   try {
     return m.usesLocalTable() ? "true" : "false";
   } catch (Exception e) {
     return "exception";
   }
 }
コード例 #2
0
 public String getComplete() {
   try {
     return m.isTablesComplete() ? "true" : "false";
   } catch (IOException e) {
     return "exception";
   }
 }
コード例 #3
0
 public String getBitsOk() {
   try {
     if (!getComplete().equals("true")) return "incomplete";
     return m.isBitCountOk() ? "true" : "false"; // LOOK using bit count 1
   } catch (Exception e) {
     return "exception";
   }
 }
コード例 #4
0
  private void writeAll() {
    List<MessageBean> beans = messageTable.getBeans();
    HashMap<Integer, Message> map = new HashMap<Integer, Message>(2 * beans.size());

    for (MessageBean mb : beans) {
      map.put(mb.m.hashCode(), mb.m);
    }

    if (fileChooser == null)
      fileChooser = new FileManager(null, null, null, (PreferencesExt) prefs.node("FileManager"));

    String defloc = (raf.getLocation() == null) ? "." : raf.getLocation();
    String dirName = fileChooser.chooseDirectory(defloc);
    if (dirName == null) return;

    try {
      int count = 0;
      for (Message m : map.values()) {
        String header = m.getHeader();
        if (header != null) {
          header = header.split(" ")[0];
        } else {
          header = Integer.toString(Math.abs(m.hashCode()));
        }

        File file = new File(dirName + "/" + header + ".bufr");
        FileOutputStream fos = new FileOutputStream(file);
        WritableByteChannel wbc = fos.getChannel();
        wbc.write(ByteBuffer.wrap(m.getHeader().getBytes()));
        byte[] raw = scan.getMessageBytes(m);
        wbc.write(ByteBuffer.wrap(raw));
        wbc.close();
        count++;
      }
      JOptionPane.showMessageDialog(
          BufrMessageViewer.this, count + " successfully written to " + dirName);

    } catch (IOException e1) {
      JOptionPane.showMessageDialog(BufrMessageViewer.this, e1.getMessage());
      e1.printStackTrace();
    }
  }
コード例 #5
0
  private void dumpDDS() {
    List<MessageBean> beans = messageTable.getBeans();
    HashMap<Integer, Message> map = new HashMap<Integer, Message>(2 * beans.size());

    for (MessageBean mb : beans) {
      map.put(mb.m.hashCode(), mb.m);
    }

    if (fileChooser == null)
      fileChooser = new FileManager(null, null, null, (PreferencesExt) prefs.node("FileManager"));

    String defloc = (raf.getLocation() == null) ? "." : raf.getLocation();
    int pos = defloc.lastIndexOf(".");
    if (pos > 0) defloc = defloc.substring(0, pos);
    String filename = fileChooser.chooseFilenameToSave(defloc + ".txt");
    if (filename == null) return;

    try {
      File file = new File(filename);
      FileOutputStream fos = new FileOutputStream(file);

      int count = 0;
      for (Message m : map.values()) {
        Formatter f = new Formatter(fos);
        m.dump(f);
        f.flush();
        count++;
      }
      fos.close();
      JOptionPane.showMessageDialog(
          BufrMessageViewer.this, count + " successfully written to " + filename);

    } catch (IOException e1) {
      JOptionPane.showMessageDialog(BufrMessageViewer.this, e1.getMessage());
      e1.printStackTrace();
    }
  }
コード例 #6
0
 public String getDate() {
   return df.toDateTimeString(m.getReferenceTime());
 }
コード例 #7
0
 public long getSize() {
   return m.getMessageSize();
 }
コード例 #8
0
 public int getNobs() {
   return m.getNumberDatasets();
 }
コード例 #9
0
 public String getHeader() {
   return m.getHeader();
 }
コード例 #10
0
 public String getTable() {
   return m.getTableName();
 }
コード例 #11
0
 public String getCenter() {
   return m.getCenterName();
 }
コード例 #12
0
 public String getCategory() throws IOException {
   return m.getCategoryFullName();
 }