锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品自在线一区二区,亚洲国产av玩弄放荡人妇,国产乱辈通伦影片在线播放亚洲http://www.tkk7.com/fadesea/category/8240.htmlzh-cnFri, 02 Mar 2007 02:54:19 GMTFri, 02 Mar 2007 02:54:19 GMT60java鎿嶄綔DBF鏂囦歡婧愭枃浠?/title><link>http://www.tkk7.com/fadesea/articles/35263.html</link><dc:creator>fadesea</dc:creator><author>fadesea</author><pubDate>Tue, 14 Mar 2006 09:23:00 GMT</pubDate><guid>http://www.tkk7.com/fadesea/articles/35263.html</guid><wfw:comment>http://www.tkk7.com/fadesea/comments/35263.html</wfw:comment><comments>http://www.tkk7.com/fadesea/articles/35263.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/fadesea/comments/commentRss/35263.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/fadesea/services/trackbacks/35263.html</trackback:ping><description><![CDATA[<P>1.JDBField.java</P> <P><BR>package com.svcon.jdbf;</P> <P>import java.text.*;<BR>import java.util.Date;</P> <P>public class JDBField<BR>{</P> <P>    public JDBField(String s, char c, int i, int j)<BR>        throws JDBFException<BR>    {<BR>        if(s.length() > 10)<BR>            throw new JDBFException("The field name is more than 10 characters long: " + s);<BR>        if(c != 'C' && c != 'N' && c != 'L' && c != 'D' && c != 'F')<BR>            throw new JDBFException("The field type is not a valid. Got: " + c);<BR>        if(i < 1)<BR>            throw new JDBFException("The field length should be a positive integer. Got: " + i);<BR>        if(c == 'C' && i >= 254)<BR>            throw new JDBFException("The field length should be less than 254 characters for character fields. Got: " + i);<BR>        if(c == 'N' && i >= 21)<BR>            throw new JDBFException("The field length should be less than 21 digits for numeric fields. Got: " + i);<BR>        if(c == 'L' && i != 1)<BR>            throw new JDBFException("The field length should be 1 characater for logical fields. Got: " + i);<BR>        if(c == 'D' && i != 8)<BR>            throw new JDBFException("The field length should be 8 characaters for date fields. Got: " + i);<BR>        if(c == 'F' && i >= 21)<BR>            throw new JDBFException("The field length should be less than 21 digits for floating point fields. Got: " + i);<BR>        if(j < 0)<BR>            throw new JDBFException("The field decimal count should not be a negative integer. Got: " + j);<BR>        if((c == 'C' || c == 'L' || c == 'D') && j != 0)<BR>            throw new JDBFException("The field decimal count should be 0 for character, logical, and date fields. Got: " + j);<BR>        if(j > i - 1)<BR>        {<BR>            throw new JDBFException("The field decimal count should be less than the length - 1. Got: " + j);<BR>        } else<BR>        {<BR>            name = s;<BR>            type = c;<BR>            length = i;<BR>            decimalCount = j;<BR>            return;<BR>        }<BR>    }</P> <P>    public String getName()<BR>    {<BR>        return name;<BR>    }</P> <P>    public char getType()<BR>    {<BR>        return type;<BR>    }</P> <P>    public int getLength()<BR>    {<BR>        return length;<BR>    }</P> <P>    public int getDecimalCount()<BR>    {<BR>        return decimalCount;<BR>    }</P> <P>    public String format(Object obj)<BR>        throws JDBFException<BR>    {<BR>        if(type == 'N' || type == 'F')<BR>        {<BR>            if(obj == null)<BR>                obj = new Double(0.0D);<BR>            if(obj instanceof Number)<BR>            {<BR>                Number number = (Number)obj;<BR>                StringBuffer stringbuffer = new StringBuffer(getLength());<BR>                for(int i = 0; i < getLength(); i++)<BR>                    stringbuffer.append("#");</P> <P>                if(getDecimalCount() > 0)<BR>                    stringbuffer.setCharAt(getLength() - getDecimalCount() - 1, '.');<BR>                DecimalFormat decimalformat = new DecimalFormat(stringbuffer.toString());<BR>                String s1 = decimalformat.format(number);<BR>                int k = getLength() - s1.length();<BR>                if(k < 0)<BR>                    throw new JDBFException("Value " + number + " cannot fit in pattern: '" + stringbuffer + "'.");<BR>                StringBuffer stringbuffer2 = new StringBuffer(k);<BR>                for(int l = 0; l < k; l++)<BR>                    stringbuffer2.append(" ");</P> <P>                return stringbuffer2 + s1;<BR>            } else<BR>            {<BR>                throw new JDBFException("Expected a Number, got " + obj.getClass() + ".");<BR>            }<BR>        }<BR>        if(type == 'C')<BR>        {<BR>            if(obj == null)<BR>                obj = "";<BR>            if(obj instanceof String)<BR>            {<BR>                String s = (String)obj;<BR>                if(s.length() > getLength())<BR>                    throw new JDBFException("'" + obj + "' is longer than " + getLength() + " characters.");<BR>                StringBuffer stringbuffer1 = new StringBuffer(getLength() - s.length());<BR>                for(int j = 0; j < getLength() - s.length(); j++)<BR>                    stringbuffer1.append(' ');</P> <P>                return s + stringbuffer1;<BR>            } else<BR>            {<BR>                throw new JDBFException("Expected a String, got " + obj.getClass() + ".");<BR>            }<BR>        }<BR>        if(type == 'L')<BR>        {<BR>            if(obj == null)<BR>                obj = new Boolean(false);<BR>            if(obj instanceof Boolean)<BR>            {<BR>                Boolean boolean1 = (Boolean)obj;<BR>                return boolean1.booleanValue() ? "Y" : "N";<BR>            } else<BR>            {<BR>                throw new JDBFException("Expected a Boolean, got " + obj.getClass() + ".");<BR>            }<BR>        }<BR>        if(type == 'D')<BR>        {<BR>            if(obj == null)<BR>                obj = new Date();<BR>            if(obj instanceof Date)<BR>            {<BR>                Date date = (Date)obj;<BR>                SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyyMMdd");<BR>                return simpledateformat.format(date);<BR>            } else<BR>            {<BR>                throw new JDBFException("Expected a Date, got " + obj.getClass() + ".");<BR>            }<BR>        } else<BR>        {<BR>            throw new JDBFException("Unrecognized JDBFField type: " + type);<BR>        }<BR>    }</P> <P>    public Object parse(String s)<BR>        throws JDBFException<BR>    {<BR>        s = s.trim();<BR>        if(type == 'N' || type == 'F')<BR>        {<BR>            if(s.equals(""))<BR>                s = "0";<BR>            try<BR>            {<BR>                if(getDecimalCount() == 0)<BR>                    return new Long(s);<BR>                else<BR>                    return new Double(s);<BR>            }<BR>            catch(NumberFormatException numberformatexception)<BR>            {<BR>                throw new JDBFException(numberformatexception);<BR>            }<BR>        }<BR>        if(type == 'C')<BR>            return s;<BR>        if(type == 'L')<BR>        {<BR>            if(s.equals("Y") || s.equals("y") || s.equals("T") || s.equals("t"))<BR>                return new Boolean(true);<BR>            if(s.equals("N") || s.equals("n") || s.equals("F") || s.equals("f"))<BR>                return new Boolean(false);<BR>            else<BR>                throw new JDBFException("Unrecognized value for logical field: " + s);<BR>        }<BR>        if(type == 'D')<BR>        {<BR>            SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyyMMdd");<BR>            try<BR>            {<BR>                if("".equals(s))<BR>                    return null;<BR>                else<BR>                    return simpledateformat.parse(s);<BR>            }<BR>            catch(ParseException parseexception)<BR>            {<BR>                throw new JDBFException(parseexception);<BR>            }<BR>        } else<BR>        {<BR>            throw new JDBFException("Unrecognized JDBFField type: " + type);<BR>        }<BR>    }</P> <P>    public String toString()<BR>    {<BR>        return name;<BR>    }</P> <P>    private String name;<BR>    private char type;<BR>    private int length;<BR>    private int decimalCount;<BR>}</P> <P>2.DBFReader.java</P> <P><BR>package com.svcon.jdbf;</P> <P>import java.io.*;</P> <P>public class DBFReader<BR>{</P> <P>    public DBFReader(String s)<BR>        throws JDBFException<BR>    {<BR>        stream = null;<BR>        fields = null;<BR>        nextRecord = null;<BR>        try<BR>        {<BR>            init(new FileInputStream(s));<BR>        }<BR>        catch(FileNotFoundException filenotfoundexception)<BR>        {<BR>            throw new JDBFException(filenotfoundexception);<BR>        }<BR>    }</P> <P>    public DBFReader(InputStream inputstream)<BR>        throws JDBFException<BR>    {<BR>        stream = null;<BR>        fields = null;<BR>        nextRecord = null;<BR>        init(inputstream);<BR>    }</P> <P>    private void init(InputStream inputstream)<BR>        throws JDBFException<BR>    {<BR>        try<BR>        {<BR>            stream = new DataInputStream(inputstream);<BR>            int i = readHeader();<BR>            fields = new JDBField[i];<BR>            int j = 1;<BR>            for(int k = 0; k < i; k++)<BR>            {<BR>                fields[k] = readFieldHeader();<BR>                j += fields[k].getLength();<BR>            }</P> <P>            if(stream.read() < 1)<BR>                throw new JDBFException("Unexpected end of file reached.");<BR>            nextRecord = new byte[j];<BR>            try<BR>            {<BR>                stream.readFully(nextRecord);<BR>            }<BR>            catch(EOFException eofexception)<BR>            {<BR>                nextRecord = null;<BR>                stream.close();<BR>            }<BR>        }<BR>        catch(IOException ioexception)<BR>        {<BR>            throw new JDBFException(ioexception);<BR>        }<BR>    }</P> <P>    private int readHeader()<BR>        throws IOException, JDBFException<BR>    {<BR>        byte abyte0[] = new byte[16];<BR>        try<BR>        {<BR>            stream.readFully(abyte0);<BR>        }<BR>        catch(EOFException eofexception)<BR>        {<BR>            throw new JDBFException("Unexpected end of file reached.");<BR>        }<BR>        int i = abyte0[8];<BR>        if(i < 0)<BR>            i += 256;<BR>        i += 256 * abyte0[9];<BR>        i = --i / 32;<BR>        i--;<BR>        try<BR>        {<BR>            stream.readFully(abyte0);<BR>        }<BR>        catch(EOFException eofexception1)<BR>        {<BR>            throw new JDBFException("Unexpected end of file reached.");<BR>        }<BR>        return i;<BR>    }</P> <P>    private JDBField readFieldHeader()<BR>        throws IOException, JDBFException<BR>    {<BR>        byte abyte0[] = new byte[16];<BR>        try<BR>        {<BR>            stream.readFully(abyte0);<BR>        }<BR>        catch(EOFException eofexception)<BR>        {<BR>            throw new JDBFException("Unexpected end of file reached.");<BR>        }<BR>        StringBuffer stringbuffer = new StringBuffer(10);<BR>        for(int i = 0; i < 10; i++)<BR>        {<BR>            if(abyte0[i] == 0)<BR>                break;<BR>            stringbuffer.append((char)abyte0[i]);<BR>        }</P> <P>        char c = (char)abyte0[11];<BR>        try<BR>        {<BR>            stream.readFully(abyte0);<BR>        }<BR>        catch(EOFException eofexception1)<BR>        {<BR>            throw new JDBFException("Unexpected end of file reached.");<BR>        }<BR>        int j = abyte0[0];<BR>        int k = abyte0[1];<BR>        if(j < 0)<BR>            j += 256;<BR>        if(k < 0)<BR>            k += 256;<BR>        return new JDBField(stringbuffer.toString(), c, j, k);<BR>    }</P> <P>    public int getFieldCount()<BR>    {<BR>        return fields.length;<BR>    }</P> <P>    public JDBField getField(int i)<BR>    {<BR>        return fields[i];<BR>    }</P> <P>    public boolean hasNextRecord()<BR>    {<BR>        return nextRecord != null;<BR>    }</P> <P>    public Object[] nextRecord()<BR>        throws JDBFException<BR>    {<BR>        if(!hasNextRecord())<BR>            throw new JDBFException("No more records available.");<BR>        Object aobj[] = new Object[fields.length];<BR>        int i = 1;<BR>        for(int j = 0; j < aobj.length; j++)<BR>        {<BR>            int k = fields[j].getLength();<BR>            StringBuffer stringbuffer = new StringBuffer(k);<BR>            stringbuffer.append(new String(nextRecord, i, k));<BR>            aobj[j] = fields[j].parse(stringbuffer.toString());<BR>            i += fields[j].getLength();<BR>        }</P> <P>        try<BR>        {<BR>            stream.readFully(nextRecord);<BR>        }<BR>        catch(EOFException eofexception)<BR>        {<BR>            nextRecord = null;<BR>        }<BR>        catch(IOException ioexception)<BR>        {<BR>            throw new JDBFException(ioexception);<BR>        }<BR>        return aobj;<BR>    }</P> <P>    public void close()<BR>        throws JDBFException<BR>    {<BR>        nextRecord = null;<BR>        try<BR>        {<BR>            stream.close();<BR>        }<BR>        catch(IOException ioexception)<BR>        {<BR>            throw new JDBFException(ioexception);<BR>        }<BR>    }</P> <P>    private DataInputStream stream;<BR>    private JDBField fields[];<BR>    private byte nextRecord[];<BR>}</P> <P>3.DBFWriter.java</P> <P><BR>package com.svcon.jdbf;</P> <P>import java.io.*;<BR>import java.util.Calendar;</P> <P>public class DBFWriter<BR>{</P> <P>    public DBFWriter(String s, JDBField ajdbfield[])<BR>        throws JDBFException<BR>    {<BR>        stream = null;<BR>        recCount = 0;<BR>        fields = null;<BR>        fileName = null;<BR>        dbfEncoding = null;<BR>        fileName = s;<BR>        try<BR>        {<BR>            init(new FileOutputStream(s), ajdbfield);<BR>        }<BR>        catch(FileNotFoundException filenotfoundexception)<BR>        {<BR>            throw new JDBFException(filenotfoundexception);<BR>        }<BR>    }</P> <P>    public DBFWriter(OutputStream outputstream, JDBField ajdbfield[])<BR>        throws JDBFException<BR>    {<BR>        stream = null;<BR>        recCount = 0;<BR>        fields = null;<BR>        fileName = null;<BR>        dbfEncoding = null;<BR>        init(outputstream, ajdbfield);<BR>    }</P> <P>    public DBFWriter(String s, JDBField ajdbfield[], String s1)<BR>        throws JDBFException<BR>    {<BR>        stream = null;<BR>        recCount = 0;<BR>        fields = null;<BR>        fileName = null;<BR>        dbfEncoding = null;<BR>        fileName = s;<BR>        try<BR>        {<BR>            dbfEncoding = s1;<BR>            init(new FileOutputStream(s), ajdbfield);<BR>        }<BR>        catch(FileNotFoundException filenotfoundexception)<BR>        {<BR>            throw new JDBFException(filenotfoundexception);<BR>        }<BR>    }</P> <P>    private void init(OutputStream outputstream, JDBField ajdbfield[])<BR>        throws JDBFException<BR>    {<BR>        fields = ajdbfield;<BR>        try<BR>        {<BR>            stream = new BufferedOutputStream(outputstream);<BR>            writeHeader();<BR>            for(int i = 0; i < ajdbfield.length; i++)<BR>                writeFieldHeader(ajdbfield[i]);</P> <P>            stream.write(13);<BR>            stream.flush();<BR>        }<BR>        catch(Exception exception)<BR>        {<BR>            throw new JDBFException(exception);<BR>        }<BR>    }</P> <P>    private void writeHeader()<BR>        throws IOException<BR>    {<BR>        byte abyte0[] = new byte[16];<BR>        abyte0[0] = 3;<BR>        Calendar calendar = Calendar.getInstance();<BR>        abyte0[1] = (byte)(calendar.get(1) - 1900);<BR>        abyte0[2] = (byte)calendar.get(2);<BR>        abyte0[3] = (byte)calendar.get(5);<BR>        abyte0[4] = 0;<BR>        abyte0[5] = 0;<BR>        abyte0[6] = 0;<BR>        abyte0[7] = 0;<BR>        int i = (fields.length + 1) * 32 + 1;<BR>        abyte0[8] = (byte)(i % 256);<BR>        abyte0[9] = (byte)(i / 256);<BR>        int j = 1;<BR>        for(int k = 0; k < fields.length; k++)<BR>            j += fields[k].getLength();</P> <P>        abyte0[10] = (byte)(j % 256);<BR>        abyte0[11] = (byte)(j / 256);<BR>        abyte0[12] = 0;<BR>        abyte0[13] = 0;<BR>        abyte0[14] = 0;<BR>        abyte0[15] = 0;<BR>        stream.write(abyte0, 0, abyte0.length);<BR>        for(int l = 0; l < 16; l++)<BR>            abyte0[l] = 0;</P> <P>        stream.write(abyte0, 0, abyte0.length);<BR>    }</P> <P>    private void writeFieldHeader(JDBField jdbfield)<BR>        throws IOException<BR>    {<BR>        byte abyte0[] = new byte[16];<BR>        String s = jdbfield.getName();<BR>        int i = s.length();<BR>        if(i > 10)<BR>            i = 10;<BR>        for(int j = 0; j < i; j++)<BR>            abyte0[j] = (byte)s.charAt(j);</P> <P>        for(int k = i; k <= 10; k++)<BR>            abyte0[k] = 0;</P> <P>        abyte0[11] = (byte)jdbfield.getType();<BR>        abyte0[12] = 0;<BR>        abyte0[13] = 0;<BR>        abyte0[14] = 0;<BR>        abyte0[15] = 0;<BR>        stream.write(abyte0, 0, abyte0.length);<BR>        for(int l = 0; l < 16; l++)<BR>            abyte0[l] = 0;</P> <P>        abyte0[0] = (byte)jdbfield.getLength();<BR>        abyte0[1] = (byte)jdbfield.getDecimalCount();<BR>        stream.write(abyte0, 0, abyte0.length);<BR>    }</P> <P>    public void addRecord(Object aobj[])<BR>        throws JDBFException<BR>    {<BR>        if(aobj.length != fields.length)<BR>            throw new JDBFException("Error adding record: Wrong number of values. Expected " + fields.length + ", got " + aobj.length + ".");<BR>        int i = 0;<BR>        for(int j = 0; j < fields.length; j++)<BR>            i += fields[j].getLength();</P> <P>        byte abyte0[] = new byte[i];<BR>        int k = 0;<BR>        for(int l = 0; l < fields.length; l++)<BR>        {<BR>            String s = fields[l].format(aobj[l]);<BR>            byte abyte1[];<BR>            try<BR>            {<BR>                if(dbfEncoding != null)<BR>                    abyte1 = s.getBytes(dbfEncoding);<BR>                else<BR>                    abyte1 = s.getBytes();<BR>            }<BR>            catch(UnsupportedEncodingException unsupportedencodingexception)<BR>            {<BR>                throw new JDBFException(unsupportedencodingexception);<BR>            }<BR>            for(int i1 = 0; i1 < fields[l].getLength(); i1++)<BR>                abyte0[k + i1] = abyte1[i1];</P> <P>            k += fields[l].getLength();<BR>        }</P> <P>        try<BR>        {<BR>            stream.write(32);<BR>            stream.write(abyte0, 0, abyte0.length);<BR>            stream.flush();<BR>        }<BR>        catch(IOException ioexception)<BR>        {<BR>            throw new JDBFException(ioexception);<BR>        }<BR>        recCount++;<BR>    }</P> <P>    public void close()<BR>        throws JDBFException<BR>    {<BR>        try<BR>        {<BR>            stream.write(26);<BR>            stream.close();<BR>            RandomAccessFile randomaccessfile = new RandomAccessFile(fileName, "rw");<BR>            randomaccessfile.seek(4L);<BR>            byte abyte0[] = new byte[4];<BR>            abyte0[0] = (byte)(recCount % 256);<BR>            abyte0[1] = (byte)((recCount / 256) % 256);<BR>            abyte0[2] = (byte)((recCount / 0x10000) % 256);<BR>            abyte0[3] = (byte)((recCount / 0x1000000) % 256);<BR>            randomaccessfile.write(abyte0, 0, abyte0.length);<BR>            randomaccessfile.close();<BR>        }<BR>        catch(IOException ioexception)<BR>        {<BR>            throw new JDBFException(ioexception);<BR>        }<BR>    }</P> <P>    private BufferedOutputStream stream;<BR>    private int recCount;<BR>    private JDBField fields[];<BR>    private String fileName;<BR>    private String dbfEncoding;<BR>}</P> <P>4.JDBFException.java</P> <P><BR>package com.svcon.jdbf;</P> <P>import java.io.PrintStream;<BR>import java.io.PrintWriter;</P> <P>public class JDBFException extends Exception<BR>{</P> <P>    public JDBFException(String s)<BR>    {<BR>        this(s, null);<BR>    }</P> <P>    public JDBFException(Throwable throwable)<BR>    {<BR>        this(throwable.getMessage(), throwable);<BR>    }</P> <P>    public JDBFException(String s, Throwable throwable)<BR>    {<BR>        super(s);<BR>        detail = throwable;<BR>    }</P> <P>    public String getMessage()<BR>    {<BR>        if(detail == null)<BR>            return super.getMessage();<BR>        else<BR>            return super.getMessage();<BR>    }</P> <P>    public void printStackTrace(PrintStream printstream)<BR>    {<BR>        if(detail == null)<BR>        {<BR>            super.printStackTrace(printstream);<BR>            return;<BR>        }<BR>        PrintStream printstream1 = printstream;<BR>        printstream1.println(this);<BR>        detail.printStackTrace(printstream);<BR>        return;<BR>    }</P> <P>    public void printStackTrace()<BR>    {<BR>        printStackTrace(System.err);<BR>    }</P> <P>    public void printStackTrace(PrintWriter printwriter)<BR>    {<BR>        if(detail == null)<BR>        {<BR>            super.printStackTrace(printwriter);<BR>            return;<BR>        }<BR>        PrintWriter printwriter1 = printwriter;</P> <P>        printwriter1.println(this);<BR>        detail.printStackTrace(printwriter);<BR>        return;<BR>    }</P> <P>    private Throwable detail;<BR>}<BR></P> <P>5.Test.java (渚涙祴璇?</P> <P>import com.svcon.jdbf.DBFReader;<BR>import java.io.PrintStream;<BR>import java.net.URL;</P> <P>public class Test<BR>{</P> <P>    public Test()<BR>    {<BR>    }</P> <P>    public static void main(String args[])<BR>        throws Exception<BR>    {<BR>        DBFReader dbfreader = new DBFReader("c:/test.dbf");<BR>        int i;<BR>        for(i = 0; dbfreader.hasNextRecord(); i++)<BR>        {<BR>            Object aobj[] = dbfreader.nextRecord();<BR>        }</P> <P>        System.out.println("Total Count: " + i);<BR>    }<BR>}</P><img src ="http://www.tkk7.com/fadesea/aggbug/35263.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/fadesea/" target="_blank">fadesea</a> 2006-03-14 17:23 <a href="http://www.tkk7.com/fadesea/articles/35263.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>java鎿嶄綔csv鏂囦歡http://www.tkk7.com/fadesea/articles/35097.htmlfadeseafadeseaMon, 13 Mar 2006 09:51:00 GMThttp://www.tkk7.com/fadesea/articles/35097.htmlhttp://www.tkk7.com/fadesea/comments/35097.htmlhttp://www.tkk7.com/fadesea/articles/35097.html#Feedback0http://www.tkk7.com/fadesea/comments/commentRss/35097.htmlhttp://www.tkk7.com/fadesea/services/trackbacks/35097.htmlimport java.sql.*;

public class DemoDriver
{
  public static void main(String[] args)
  {
    try
    {
      // load the driver into memory
      Class.forName("org.relique.jdbc.csv.CsvDriver");

      // create a connection. The first command line parameter is assumed to
      //  be the directory in which the .csv files are held
      Connection conn = DriverManager.getConnection("jdbc:relique:csv:" + args[0] );

      // create a Statement object to execute the query with
      Statement stmt = conn.createStatement();

      // Select the ID and NAME columns from sample.csv
      ResultSet results = stmt.executeQuery("SELECT ID,NAME FROM sample");

      // dump out the results
      while (results.next())
      {
        System.out.println("ID= " + results.getString("ID") + "   NAME= " + results.getString("NAME"));
      }

      // clean up
      results.close();
      stmt.close();
      conn.close();
    }
    catch(Exception e)
    {
      System.out.println("Oops-> " + e);
    }
  }
}



fadesea 2006-03-13 17:51 鍙戣〃璇勮
]]>
瀛楃涓叉搷浣?/title><link>http://www.tkk7.com/fadesea/articles/35098.html</link><dc:creator>fadesea</dc:creator><author>fadesea</author><pubDate>Mon, 13 Mar 2006 09:51:00 GMT</pubDate><guid>http://www.tkk7.com/fadesea/articles/35098.html</guid><wfw:comment>http://www.tkk7.com/fadesea/comments/35098.html</wfw:comment><comments>http://www.tkk7.com/fadesea/articles/35098.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/fadesea/comments/commentRss/35098.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/fadesea/services/trackbacks/35098.html</trackback:ping><description><![CDATA[<P><STRONG><FONT color=#6911ee>錛?@ page import="java.util.regex.*"%錛?BR>錛?<BR>Pattern p=null; //姝e垯琛ㄨ揪寮?BR>Matcher m=null; //鎿嶄綔鐨勫瓧絎︿覆<BR>boolean b;<BR>String s=null;<BR>StringBuffer ***=null;<BR>int i=0;<BR>//瀛楃涓插尮閰嶏紝榪欐槸涓嶇鍚堢殑<BR>p = Pattern.compile("a*b");<BR>m = p.matcher("baaaaab");<BR>b = m.matches();<BR>out.println(b+"錛渂r錛?);<BR>//瀛楃涓插尮閰嶏紝榪欐槸絎﹀悎鐨?BR>p = Pattern.compile("a*b");<BR>m = p.matcher("aaaaab");<BR>b = m.matches();<BR>out.println(b+"錛渂r錛?);<BR>//瀛楃涓叉浛鎹?BR>p = Pattern.compile("ab");<BR>m = p.matcher("aaaaab");<BR>s = m.replaceAll("d"); <BR>out.println(s+"錛渂r錛?);<BR>p = Pattern.compile("a*b");<BR>m = p.matcher("aaaaab");<BR>s = m.replaceAll("d"); <BR>out.println(s+"錛渂r錛?);<BR>p = Pattern.compile("a*b");<BR>m = p.matcher("caaaaab");<BR>s = m.replaceAll("d"); <BR>out.println(s+"錛渂r錛?);<BR>//瀛楃涓叉煡鎵?BR>p = Pattern.compile("cat");<BR>m = p.matcher("one cat two cats in the yard");<BR>*** = new StringBuffer();<BR>while (m.find()) {<BR>m.appendReplacement(***, "dog");<BR>i++;<BR>}<BR>m.appendTail(***);<BR>out.println(***.toString()+"錛渂r錛?);<BR>out.println(i+"錛渂r錛?);<BR>i=0; <BR>p = Pattern.compile("cat");<BR>m = p.matcher("one cat two ca tsi nthe yard");<BR>*** = new StringBuffer();<BR>while (m.find()) {<BR>m.appendReplacement(***, "dog");<BR>i++;<BR>}<BR>m.appendTail(***);<BR>out.println(***.toString()+"錛渂r錛?);<BR>out.println(i+"錛渂r錛?);<BR>p = Pattern.compile("cat");<BR>m = p.matcher("one cat two cats in the yard");<BR>p=m.pattern();<BR>m = p.matcher("bacatab");<BR>b = m.matches();<BR>out.println(b+"錛渂r錛?); <BR>s = m.replaceAll("dog"); <BR>out.println(s+"錛渂r錛?); <BR>i=0;<BR>p = Pattern.compile("(fds){2,}");<BR>m = p.matcher("dsa da fdsfds aaafdsafds aaf");<BR>*** = new StringBuffer();<BR>while (m.find()) {<BR>m.appendReplacement(***, "dog");<BR>i++;<BR>}</FONT></STRONG></P> <P><STRONG><FONT color=#6911ee>m.appendTail(***);<BR>out.println(***.toString()+"錛渂r錛?);<BR>out.println(i+"錛渂r錛?);</FONT></STRONG></P> <P><STRONG><FONT color=#6911ee>p = Pattern.compile("cat");<BR>m = p.matcher("one cat two cats in the yard");<BR>*** = new StringBuffer();<BR>while (m.find()) {<BR>m.appendReplacement(***, "錛渇ont color=\"red\"錛瀋at錛?font錛?);<BR>}<BR>m.appendTail(***);<BR>out.println(***.toString()+"錛渂r錛?);<BR>String aa=***.toString();<BR>out.println(aa+"錛渂r錛?);<BR>//瀛楃涓插垎鍓?BR>p = Pattern.compile("a+");<BR>String[] a=p.split("caaaaaat");<BR>for(i=0;i錛渁.length;i++)<BR>{<BR>out.println(a[i]+"錛渂r錛?);<BR>}<BR>p = Pattern.compile("a+");<BR>a=p.split("c aa aaaa t",0);<BR>for(i=0;i錛渁.length;i++)<BR>{<BR>out.println(a[i]+"錛渂r錛?);<BR>}<BR>p = Pattern.compile(" +");<BR>a=p.split("c aa aaaa t",0);<BR>for(i=0;i錛渁.length;i++)<BR>{<BR>out.println(a[i]+"錛渂r錛?);<BR>}<BR>p = Pattern.compile("\\+");<BR>a=p.split("dsafasdfdsafsda+dsagfasdfa+sdafds");<BR>out.println(a.length+"錛渂r錛?);<BR>for(i=0;i錛渁.length;i++)<BR>{<BR>out.println(a[i]+"錛渂r錛?);<BR>}<BR>%錛?BR></FONT></STRONG></P><img src ="http://www.tkk7.com/fadesea/aggbug/35098.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/fadesea/" target="_blank">fadesea</a> 2006-03-13 17:51 <a href="http://www.tkk7.com/fadesea/articles/35098.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://amjt9.com" target="_blank">免费精品国产自产拍在</a>| <a href="http://31xyz.com" target="_blank">国产又大又粗又硬又长免费</a>| <a href="http://yimintech.com" target="_blank">亚洲高清无在码在线无弹窗 </a>| <a href="http://zdxxxx.com" target="_blank">一级特黄色毛片免费看</a>| <a href="http://www04ggg.com" target="_blank">亚洲日产无码中文字幕</a>| <a href="http://lyczyb.com" target="_blank">亚洲免费黄色网址</a>| <a href="http://ekyzs.com" target="_blank">特级毛片免费观看视频</a>| <a href="http://zmtme.com" target="_blank">久久久久亚洲精品天堂</a>| <a href="http://77663499.com" target="_blank">国产又大又粗又硬又长免费</a>| <a href="http://www22432.com" target="_blank">国产99视频精品免费专区</a>| <a href="http://avxyz.com" target="_blank">亚洲人成人无码.www石榴</a>| <a href="http://0515zs.com" target="_blank">亚洲国产另类久久久精品黑人 </a>| <a href="http://jxxitutu.com" target="_blank">亚洲av区一区二区三</a>| <a href="http://352362.com" target="_blank">中文字幕成人免费视频</a>| <a href="http://jufandev.com" target="_blank">黄色网页免费观看</a>| <a href="http://173ba.com" target="_blank">亚洲成在人线电影天堂色</a>| <a href="http://dzhyyy.com" target="_blank">亚洲午夜精品一级在线播放放</a>| <a href="http://www-993789.com" target="_blank">永久看日本大片免费35分钟</a>| <a href="http://my55572.com" target="_blank">男女污污污超污视频免费在线看</a>| <a href="http://wwwaa875.com" target="_blank">亚洲毛片免费视频</a>| <a href="http://664403.com" target="_blank">黑人大战亚洲人精品一区 </a>| <a href="http://77sosoo.com" target="_blank">亚洲午夜免费视频</a>| <a href="http://123470c.com" target="_blank">成人午夜影视全部免费看</a>| <a href="http://bjjs365.com" target="_blank">亚洲一欧洲中文字幕在线</a>| <a href="http://xjkakatong.com" target="_blank">久久久久亚洲av毛片大</a>| <a href="http://sxhnyl.com" target="_blank">在线播放高清国语自产拍免费</a>| <a href="http://bjtjchem.com" target="_blank">国产真人无码作爱视频免费 </a>| <a href="http://yongyihongze.com" target="_blank">久久不见久久见免费影院</a>| <a href="http://554ka.com" target="_blank">a级毛片在线免费观看</a>| <a href="http://173ba.com" target="_blank">亚洲Aⅴ在线无码播放毛片一线天</a>| <a href="http://788qj.com" target="_blank">久久久无码精品亚洲日韩按摩 </a>| <a href="http://saohuo7.com" target="_blank">XXX2高清在线观看免费视频</a>| <a href="http://352362.com" target="_blank">亚洲欧美日韩中文字幕在线一区</a>| <a href="http://626632.com" target="_blank">久久亚洲精品国产精品黑人</a>| <a href="http://9522952.com" target="_blank">免费看男女下面日出水视频</a>| <a href="http://628669.com" target="_blank">野花高清在线观看免费3中文 </a>| <a href="http://livejimmy.com" target="_blank">久久久亚洲欧洲日产国码农村</a>| <a href="http://www-66409b.com" target="_blank">heyzo亚洲精品日韩</a>| <a href="http://400209.com" target="_blank">女人被免费视频网站</a>| <a href="http://eeussdd.com" target="_blank">黄色网址免费大全</a>| <a href="http://maomaots.com" target="_blank">99久久99久久精品免费观看</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>