Class CSVReader<T>
- java.lang.Object
-
- com.alibaba.fastjson2.stream.StreamReader<T>
-
- com.alibaba.fastjson2.support.csv.CSVReader<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public abstract class CSVReader<T> extends StreamReader<T> implements Closeable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.alibaba.fastjson2.stream.StreamReader
StreamReader.ColumnStat, StreamReader.Feature, StreamReader.StreamReaderSpliterator<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<T>objectClass-
Fields inherited from class com.alibaba.fastjson2.stream.StreamReader
columns, columnStats, columnStatsMap, end, errorCount, features, fieldReaders, inputEnd, lineEnd, lineNextStart, lineSize, lineStart, lineTerminated, mapping, objectCreator, off, rowCount, SIZE_512K, typeReaders, types
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconfig(StreamReader.Feature... features)voidconfig(StreamReader.Feature feature, boolean state)protected Objecterror(int columnIndex, Exception e)interrorCount()StringgetColumn(int columnIndex)List<String>getColumns()StreamReader.ColumnStatgetColumnStat(int i)StreamReader.ColumnStatgetColumnStat(String name)List<StreamReader.ColumnStat>getColumnStats()TypegetColumnType(int columnIndex)abstract booleanisEnd()booleanisObjectSupport()static <T> CSVReader<T>of(byte[] utf8Bytes, int off, int len, Class<T> objectClass)static <T> CSVReader<T>of(byte[] utf8Bytes, int off, int len, Charset charset, ByteArrayValueConsumer consumer)static <T> CSVReader<T>of(byte[] utf8Bytes, int off, int len, Charset charset, Class<T> objectClass)static CSVReaderof(byte[] utf8Bytes, ByteArrayValueConsumer consumer)static <T> CSVReader<T>of(byte[] utf8Bytes, Class<T> objectClass)static CSVReaderof(byte[] utf8Bytes, Type... types)static <T> CSVReader<T>of(byte[] utf8Bytes, Charset charset, Class<T> objectClass)static <T> CSVReader<T>of(char[] chars, int off, int len, CharArrayValueConsumer consumer)static <T> CSVReader<T>of(char[] utf8Bytes, int off, int len, Class<T> objectClass)static <T> CSVReader<T>of(char[] chars, Class<T> objectClass)static CSVReaderof(char[] chars, Type... types)static CSVReaderof(File file, ByteArrayValueConsumer consumer)static CSVReaderof(File file, CharArrayValueConsumer consumer)static <T> CSVReader<T>of(File file, Class<T> objectClass)static CSVReaderof(File file, Type... types)static CSVReaderof(File file, Charset charset, ByteArrayValueConsumer consumer)static CSVReaderof(File file, Charset charset, CharArrayValueConsumer consumer)static <T> CSVReader<T>of(File file, Charset charset, Class<T> objectClass)static CSVReaderof(File file, Charset charset, Type... types)static <T> CSVReader<T>of(InputStream in, Class<T> objectClass)static CSVReaderof(InputStream in, Type... types)static <T> CSVReader<T>of(InputStream in, Charset charset, Class<T> objectClass)static CSVReaderof(InputStream in, Charset charset, Type... types)static <T> CSVReader<T>of(Reader reader, Class<T> objectClass)static CSVReaderof(Reader in, Type... types)static <T> CSVReaderof(String str, Class<T> objectClass)static CSVReaderof(String str, Type... types)abstract voidreadAll()abstract voidreadAll(int maxRows)List<String>readHeader()String[]readLine()List<String[]>readLineAll()TreadLineObject()List<T>readLineObjectAll()abstract voidreadLineObjectAll(boolean readHeader, Consumer<T> consumer)voidreadLineObjectAll(Consumer<T> consumer)Object[]readLineValues()protected abstract Object[]readLineValues(boolean strings)introwCount()static introwCount(byte[] bytes, StreamReader.Feature... features)static introwCount(char[] chars, StreamReader.Feature... features)static introwCount(File file)static introwCount(InputStream in)static introwCount(String str, StreamReader.Feature... features)voidskipLines(int lines)abstract voidstatAll()abstract voidstatAll(int maxRows)-
Methods inherited from class com.alibaba.fastjson2.stream.StreamReader
seekLine, stream, stream
-
-
-
-
Constructor Detail
-
CSVReader
public CSVReader(Type[] types)
-
-
Method Detail
-
config
public void config(StreamReader.Feature... features)
-
config
public void config(StreamReader.Feature feature, boolean state)
-
of
public static CSVReader of(File file, Type... types) throws IOException
- Throws:
IOException
-
of
public static CSVReader of(File file, ByteArrayValueConsumer consumer) throws IOException
- Throws:
IOException
-
of
public static CSVReader of(File file, Charset charset, ByteArrayValueConsumer consumer) throws IOException
- Throws:
IOException
-
of
public static CSVReader of(File file, CharArrayValueConsumer consumer) throws IOException
- Throws:
IOException
-
of
public static CSVReader of(File file, Charset charset, CharArrayValueConsumer consumer) throws IOException
- Throws:
IOException
-
of
public static CSVReader of(File file, Charset charset, Type... types) throws IOException
- Throws:
IOException
-
of
public static <T> CSVReader<T> of(File file, Class<T> objectClass) throws IOException
- Throws:
IOException
-
of
public static <T> CSVReader<T> of(File file, Charset charset, Class<T> objectClass) throws IOException
- Throws:
IOException
-
of
public static CSVReader of(InputStream in, Type... types) throws IOException
- Throws:
IOException
-
of
public static <T> CSVReader<T> of(InputStream in, Class<T> objectClass)
-
of
public static <T> CSVReader<T> of(InputStream in, Charset charset, Class<T> objectClass)
-
of
public static CSVReader of(InputStream in, Charset charset, Type... types)
-
of
public static <T> CSVReader<T> of(char[] chars, int off, int len, CharArrayValueConsumer consumer)
-
of
public static CSVReader of(byte[] utf8Bytes, ByteArrayValueConsumer consumer)
-
of
public static <T> CSVReader<T> of(byte[] utf8Bytes, int off, int len, Charset charset, ByteArrayValueConsumer consumer)
-
of
public static <T> CSVReader<T> of(byte[] utf8Bytes, int off, int len, Charset charset, Class<T> objectClass)
-
skipLines
public void skipLines(int lines) throws IOException- Throws:
IOException
-
getColumn
public String getColumn(int columnIndex)
-
getColumnType
public Type getColumnType(int columnIndex)
-
getColumnStats
public List<StreamReader.ColumnStat> getColumnStats()
-
readLineObject
public T readLineObject()
- Specified by:
readLineObjectin classStreamReader<T>
-
isEnd
public abstract boolean isEnd()
-
readLineValues
public final Object[] readLineValues()
-
readLineValues
protected abstract Object[] readLineValues(boolean strings)
-
readLine
public final String[] readLine()
-
rowCount
public static int rowCount(String str, StreamReader.Feature... features)
-
rowCount
public static int rowCount(byte[] bytes, StreamReader.Feature... features)
-
rowCount
public static int rowCount(char[] chars, StreamReader.Feature... features)
-
rowCount
public static int rowCount(File file) throws IOException
- Throws:
IOException
-
rowCount
public static int rowCount(InputStream in) throws IOException
- Throws:
IOException
-
errorCount
public int errorCount()
-
rowCount
public int rowCount()
-
getColumnStat
public StreamReader.ColumnStat getColumnStat(String name)
-
getColumnStat
public StreamReader.ColumnStat getColumnStat(int i)
-
isObjectSupport
public boolean isObjectSupport()
-
statAll
public abstract void statAll()
-
statAll
public abstract void statAll(int maxRows)
-
readAll
public abstract void readAll()
-
readAll
public abstract void readAll(int maxRows)
-
-