public class StorageManager extends Object
| Constructor and Description |
|---|
StorageManager() |
| Modifier and Type | Method and Description |
|---|---|
static BooleanColumn |
readBooleanColumn(String fileName,
ColumnMetadata metadata) |
static CategoryColumn |
readCategoryColumn(String fileName,
ColumnMetadata metadata) |
static FloatColumn |
readFloatColumn(String fileName,
ColumnMetadata metadata) |
static IntColumn |
readIntColumn(String fileName,
ColumnMetadata metadata) |
static DateColumn |
readLocalDateColumn(String fileName,
ColumnMetadata metadata) |
static DateTimeColumn |
readLocalDateTimeColumn(String fileName,
ColumnMetadata metadata) |
static TimeColumn |
readLocalTimeColumn(String fileName,
ColumnMetadata metadata) |
static LongColumn |
readLongColumn(String fileName,
ColumnMetadata metadata) |
static ShortColumn |
readShortColumn(String fileName,
ColumnMetadata metadata) |
static Table |
readTable(String path)
Reads a tablesaw table into memory
|
static TableMetadata |
readTableMetadata(String fileName)
Reads in a json-formatted file and creates a TableMetadata instance from it.
|
static String |
saveTable(String folderName,
Relation table)
Saves the data from the given table in the location specified by folderName.
|
static void |
writeColumn(String fileName,
BooleanColumn column) |
static void |
writeColumn(String fileName,
CategoryColumn column)
Writes out the values of the category column encoded as ints to minimize the time required for subsequent reads
|
static void |
writeColumn(String fileName,
DateColumn column) |
static void |
writeColumn(String fileName,
DateTimeColumn column) |
static void |
writeColumn(String fileName,
FloatColumn column) |
static void |
writeColumn(String fileName,
IntColumn column) |
static void |
writeColumn(String fileName,
LongColumn column) |
static void |
writeColumn(String fileName,
ShortColumn column) |
static void |
writeColumn(String fileName,
TimeColumn column) |
static void |
writeTableMetadata(String fileName,
Relation table)
Writes out a json-formatted representation of the given
table's metadata to the given file |
public static Table readTable(String path) throws IOException
path - The location of the table. It is interpreted as relative to the working directory if not fully
specified. The path will typically end in ".saw", as in "mytables/nasdaq-2015.saw"IOException - if the file cannot be readpublic static FloatColumn readFloatColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static IntColumn readIntColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static ShortColumn readShortColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static LongColumn readLongColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static DateColumn readLocalDateColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static DateTimeColumn readLocalDateTimeColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static TimeColumn readLocalTimeColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static CategoryColumn readCategoryColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static BooleanColumn readBooleanColumn(String fileName, ColumnMetadata metadata) throws IOException
IOExceptionpublic static String saveTable(String folderName, Relation table) throws IOException
NOTE: If you store a table with the same name in the same folder. The data in that folder will be over-written.
The storage format is the tablesaw compressed column-oriented format, which consists of a set of file in a folder. The name of the folder is based on the name of the table.
folderName - The location of the table (for example: "mytables")table - The table to be savedIOExceptionpublic static void writeColumn(String fileName, FloatColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, CategoryColumn column) throws IOException
The files are written Strings first, then the ints that encode them so they can be read in the opposite order
IOExceptionpublic static void writeColumn(String fileName, IntColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, ShortColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, LongColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, DateColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, DateTimeColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, TimeColumn column) throws IOException
IOExceptionpublic static void writeColumn(String fileName, BooleanColumn column) throws IOException
IOExceptionpublic static void writeTableMetadata(String fileName, Relation table) throws IOException
table's metadata to the given filefileName - Expected to be fully specifiedIOException - if the file can not be readpublic static TableMetadata readTableMetadata(String fileName) throws IOException
fileName - Expected to be fully specifiedIOException - if the file can not be readCopyright © 2017. All rights reserved.