csvloader.html
来自「基于mondrian 开源框架进行OLAP多维分析」· HTML 代码 · 共 949 行 · 第 1/3 页
HTML
949 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_15) on Thu Jul 31 17:20:13 EDT 2008 --><TITLE>CsvLoader (Mondrian OLAP Server, version 3.0.4.11371)</TITLE><META NAME="keywords" CONTENT="mondrian.test.loader.CsvLoader class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="CsvLoader (Mondrian OLAP Server, version 3.0.4.11371)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../mondrian/test/loader/CsvDBTestCase.html" title="class in mondrian.test.loader"><B>PREV CLASS</B></A> <A HREF="../../../mondrian/test/loader/DBLoader.html" title="class in mondrian.test.loader"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?mondrian/test/loader/CsvLoader.html" target="_top"><B>FRAMES</B></A> <A HREF="CsvLoader.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">mondrian.test.loader</FONT><BR>Class CsvLoader</H2><PRE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>mondrian.test.loader.CsvLoader</B></PRE><HR><DL><DT><PRE>public class <B>CsvLoader</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL></PRE><P>This is a basic Comma-separated-value (CSV, Csv) reader. As input it ultimately takes a <code>java.io.Reader</code> but has helper support for <code>java.io.InputStream, file</code> names and <code>java.io.File</code>. One can also specify a separator character other than the default comma, ',', character and, also, that the input's first line contains the names of the columns (by default this is not assumed). Lastly, this supports only the comment character '#' and only at the start of a line. This comment support could be generalized but that task is left to others. <p> To use this class one gives it a <code>java.io.Reader</code> and then calls the <code>hasNextLine</code> and <code>nextLine</code> methods much like a <code>java.io.Iterator</code> but in this case the <code>nextLine</code> method returns a <code>String[]</code> holding the, possibly null, values of the parsed next line. The size of the <code>String[]</code> is the size of the first line parsed that contains the separator character (comment lines are not used). If the number of separator characters in subsequent lines is less than the initial numbers, the trailing entries in the <code>String[]</code> returned by the <code>nextLine</code> method are null. On the other hand, if there are more separator characters in a subsequent line, the world ends with an <code>IndexOutOfBoundsException</code> (sorry, making this more graceful is also a task for others). When one is through using a <code>CsvLoader</code> instance one should call the close method (which closes the <code>Reader</code>). <p> All well and good, but there are two additional methods that can be used to extend the capabilities of this CSV parser, the <code>nextSet</code> and <code>putBack</code> methods. With these methods one can, basically, reset the <code>CsvLoader</code> to a state where it does not yet know how many separator characters to expect per line (while stay at the current line in the <code>Reader</code>). The <code>nextSet</code> (next set of CSV lines) resets the loader while the <code>putBack</code> method can be used to place the last line returned back into loader. These methods are used in <code>CsvDBLoader</code> allowing one to have multiple sets of CSV rows with differing number of values per sets. <p> There are six special start/end characters when seen prevent the recognition of both the separator character and new lines: <blockquote><pre> double quotes: "" "" single quotes: ' ' bracket: i [ ] parenthesis: ( ) braces: { } chevrons: < > </pre></blockquote> <p> Its certainly not the penultimate such parser but its hoped that its adequate.<P><P><DL><DT><B>Version:</B></DT> <DD>$Id: //open/mondrian-release/3.0/testsrc/main/mondrian/test/loader/CsvLoader.java#2 $</DD><DT><B>Author:</B></DT> <DD><a>Richard M. Emberson</a></DD></DL><HR><P><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Field Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#BRACES_END">BRACES_END</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#BRACES_START">BRACES_START</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#BRACKET_END">BRACKET_END</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#BRACKET_START">BRACKET_START</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CHEVRON_END">CHEVRON_END</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CHEVRON_START">CHEVRON_START</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#DEFAULT_SEPARATOR">DEFAULT_SEPARATOR</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#DOUBLE_QUOTE">DOUBLE_QUOTE</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static org.apache.log4j.Logger</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#LOGGER">LOGGER</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#PAREN_END">PAREN_END</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#PAREN_START">PAREN_START</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static char</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#SINGLE_QUOTE">SINGLE_QUOTE</A></B></CODE><BR> </TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CsvLoader(java.io.File)">CsvLoader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html" title="class or interface in java.io">File</A> file)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CsvLoader(java.io.File, char, boolean)">CsvLoader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html" title="class or interface in java.io">File</A> file, char separator, boolean includesHeader)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CsvLoader(java.io.InputStream)">CsvLoader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> in)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CsvLoader(java.io.InputStream, char, boolean)">CsvLoader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> in, char separator, boolean includesHeader)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CsvLoader(java.io.InputStream, char, boolean, java.lang.String)">CsvLoader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> in, char separator, boolean includesHeader, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> charset)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/test/loader/CsvLoader.html#CsvLoader(java.io.InputStream, java.lang.String)">CsvLoader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> in, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> charset)</CODE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?