示例#1
0
    String regString(String fname) {
      String fmime = "\t\t<mime>application/octet-stream</mime>\n";
      if (fname.endsWith(".jpg")) fmime = "\t\t<mime>image/jpeg</mime>\n";
      char ftype = CTinfo.fileType(fname, typeDefault);
      // 	System.err.println("fname: "+fname+", fmime: "+fmime+", ftype: "+ftype);
      int wlen = 1;
      if (ftype == 'F' || ftype == 'I' || ftype == 'N') wlen = 8;
      else if (ftype == 'f' || ftype == 'i' || ftype == 'n') wlen = 4;

      String result =
          "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
              + "<!DOCTYPE rbnb>\n"
              + "<rbnb>\n"
              + "\t\t<size>"
              + wlen
              + "</size>\n"
              + fmime
              + "</rbnb>\n";
      return (result);
    }
示例#2
0
    public PlugInChannelMap CT2PImap(
        PlugInChannelMap picm, CTmap ctmap, double tget, double tdur, String tmode) {
      int nchan = ctmap.size();
      try {
        for (int i = 0; i < nchan; i++) {
          String cname = ctmap.getName(i);
          picm.Add(cname);
          CTdata td;
          //					if(tmode.equals("absolute")) td = ctmap.getTimeData(cname, tget, tdur);	// use
          // tget,tdur for trim
          //					else						 td = ctmap.getTimeData(cname);
          if (debug)
            System.err.println(
                "getTimeData, tget: " + tget + ", tdur: " + tdur + ", tmode: " + tmode);
          //					td = ctmap.getTimeData(cname, tget, tdur, tmode);
          td = ctmap.getTimeData(cname); // already trimmed MJM 4/27/16
          if (debug)
            System.err.println(
                "cname: "
                    + cname
                    + ", fileType: "
                    + CTinfo.fileType(cname, typeDefault)
                    + ", td.size: "
                    + td.size());
          if (td == null || td.size() == 0) continue; // no data found this time

          td.setSwap(swapFlag);
          char fileType = CTinfo.fileType(cname, typeDefault);

          if (fileType != 'B') picm.PutTimes(td.getTime()); // doesn't work with byte[][]
          //				System.err.println("PutTimes len: "+td.getTime().length);
          switch (fileType) {
            case 'F':
              picm.PutDataAsFloat64(i, td.getDataAsFloat64());
              break;
            case 'f':
              picm.PutDataAsFloat32(i, td.getDataAsFloat32());
              break;
            case 'I':
              picm.PutDataAsInt64(i, td.getDataAsInt64());
              break;
            case 'i':
              picm.PutDataAsInt32(i, td.getDataAsInt32());
              break;
            case 'j':
              picm.PutDataAsInt16(i, td.getDataAsInt16());
              break;
            case 'n':
              picm.PutDataAsFloat32(i, td.getDataAsNumericF32());
              break;
            case 'N':
              picm.PutDataAsFloat64(i, td.getDataAsNumericF64());
              break;
            case 'B':
            default:
              if (debug) System.err.println("PutByte[] len: " + td.size());
              double[] time = td.getTime();
              byte[][] bdata = td.getData();
              for (int j = 0; j < td.size(); j++) {
                picm.PutTime(time[j], 0.);
                picm.PutDataAsByteArray(i, bdata[j]);
              }
              break;
          }
        }
      } catch (Exception e) {
        System.err.println("CTplugin Exception: " + e);
        //				e.printStackTrace();
        return null;
      }
      return picm;
    }