日期:2014-05-02  浏览次数:20490 次

PHP+JAVA的程序

.....................

Java Program:

/*
以下程序为余姚塑料城期货交易数据的定时追踪分析程序
是对数据的初步分析,绘图分析则交给进一步的php程序来完成
本程序完成策划于2005-5-17(友谊日)
本程序可以作为K线图原始数据库
*/
import java.net.*;
import java.io.*;
import java.nio.*;
import java.text.*;
import java.util.*;
import java.util.Date;
import java.util.regex.*;
class suliao
  {
    final static int LINE=11;
    public static void main(String args[])
      {
        String url="http://www.ex-cp.com//yy_data/quot.txt";
        String url1="http://www.51kk7.com/Forum/User/CompanyInfo.aspx?companyId=0";
        for(;;)
        {
 try
   {
     Thread.sleep(10000);
            String ori[][]=new String[LINE][14];
            int sta=0;
            //
     for(;;)
     {
     Thread.sleep(1000);
     Date date;
            SimpleDateFormat hua=new SimpleDateFormat("H m s");
     String time=hua.format(date=new Date());
     String[] hua1=time.split("\s");
     int i=Integer.parseInt(hua1[0])*3600+Integer.parseInt(hua1[1])*60+Integer.parseInt(hua1[2]);
     if(i<34100)
       break;
     if(i>39900)
       break;
            URL hp=new URL(url);
     URLConnection hpCon=hp.openConnection();
     int len=hpCon.getContentLength();
     InputStream input=hpCon.getInputStream();
     int c;
     StringBuffer hu=new StringBuffer("");
     String hu1[]=new String[LINE];
     int k=0;
     while(((c=input.read())!=-1)&&(--len>0))
       {
  if(c==10)
    {
      hu1[k]=hu.toString();
      hu=new StringBuffer("");
      k++;
    }
  else
    {
      char c1=(char)c;
      hu.append(c1);
    }
       }
     hu1[LINE-1]=hu.toString();
     String hu2[][]=new String[LINE][14];
     suliao he=new suliao();
     for(int k1=0;k1<LINE;k1++)
       hu2[k1]=he.zz(hu1[k1]);
     /*
     for(int k2=0;k2<10;k2++)
       {
  for(int k3=0;k3<14;k3++)
    System.out.print(hu2[k2][k3]+"\t");
  System.out.println("");
       }
     */
     int k2;
     if(sta==0)
       {
  ori=hu2;
  sta=1;
  for(k2=0;k2<LINE;k2++)
    he.writeinfo(hu2[k2],i);
       }
     else