public class StorageManager extends Object
Constructor and Description |
---|
StorageManager() |
Modifier and Type | Method and Description |
---|---|
static CategoryColumn |
readCategoryColumn(String fileName,
ColumnMetadata metadata) |
static Table |
readTable(String path)
Reads a tablesaw table into memory
|
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,
DoubleColumn 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) |
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 CategoryColumn readCategoryColumn(String fileName, ColumnMetadata metadata) throws IOException
IOException
public 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 savedIOException
- IOException if the file can not be readpublic static void writeColumn(String fileName, FloatColumn column) throws IOException
IOException
public static void writeColumn(String fileName, DoubleColumn column) throws IOException
IOException
public 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
IOException
- IOException if the file can not be readpublic static void writeColumn(String fileName, IntColumn column) throws IOException
IOException
public static void writeColumn(String fileName, ShortColumn column) throws IOException
IOException
public static void writeColumn(String fileName, LongColumn column) throws IOException
IOException
public static void writeColumn(String fileName, DateColumn column) throws IOException
IOException
public static void writeColumn(String fileName, DateTimeColumn column) throws IOException
IOException
public static void writeColumn(String fileName, TimeColumn column) throws IOException
IOException
public static void writeColumn(String fileName, BooleanColumn column) throws IOException
IOException
Copyright © 2017. All rights reserved.