TimeSeriesDatabase implements Closeable { public void addTSTable(final String tableName, final byte[] tableMetaData, final int sampleTime, final String[] columnNames, final String[] columnMetaData) throws IOException { byte[][] metadata = new byte[columnMetaData.length][]; for (int i = 0; i < columnMetaData.length; i++) { metadata[i] = columnMetaData[i].getBytes(StandardCharsets.UTF_8); } addTSTable(tableName, tableMetaData, sampleTime, columnNames, metadata); } TimeSeriesDatabase(final File pathToDatabaseFile);  TimeSeriesDatabase(final File pathToDatabaseFile, final byte... metaData);  TimeSeriesDatabase(final File pathToDatabaseFile, final boolean isWrite, final byte... metaData); void reReadTableInfos(); @Override void close(); boolean hasTSTable(final String tableName); void addTSTable(final String tableName,
          final byte[] tableMetaData, final int sampleTime, final String[] columnNames,
          final String[] columnMetaData); void addTSTable(final String tableName,
          final byte[] tableMetaData, final int sampleTime, final String[] columnNames,
          final byte[][] columnMetaData); void write(final long time, final String tableName, final long[] values); void flush(); String[] getColumnNames(final String tableName); TSTable getTSTable(final String tableName); Collection<TSTable> getTSTables(); Map<String, TSTable> getTsTables(); TimeSeries readAll(final String tableName); long readStartDate(final String tableName); TimeSeries read(final String tableName,
          final long startTime, final long endTime); String getDBFilePath(); JFreeChart createHeatJFreeChart(final String tableName); JFreeChart createHeatJFreeChart(final String tableName, final long startTime,
          final long endTime); JFreeChart createMinMaxAvgJFreeChart(final String tableName); JFreeChart createMinMaxAvgJFreeChart(final String tableName, final long startTime,
          final long endTime); JFreeChart createCountJFreeChart(final String tableName); JFreeChart createCountJFreeChart(final String tableName, final long startTime,
          final long endTime); List<JFreeChart> createJFreeCharts(final String tableName); List<JFreeChart> createJFreeCharts(final String tableName, final long startTime,
          final long endTime); static JFreeChart createHeatJFreeChart(final TimeSeries data, final TSTable info); static JFreeChart createMinMaxAvgJFreeChart(final TimeSeries data, final TSTable info); static JFreeChart createCountJFreeChart(final TimeSeries data, final TSTable info); static List<JFreeChart> createJFreeCharts(final TimeSeries data, final TSTable info); byte[] getMetaData(); void writeCsvTable(final String tableName, final File output); void writeCsvTables(final List<String> tableNames, final File output); @Override String toString(); @SuppressFBWarnings("MDM_THREAD_YIELD") void tail(final long pollMillis, final long from, final TSDataHandler handler); String getFilePath(); @JmxExport(value = "generateChartsInterval", description = "generate charts for all measurements in specified interval") List<String> generateCharts(final long startTimeMillis, final long endTimeMillis,
          final int width, final int height); @edu.umd.cs.findbugs.annotations.SuppressWarnings("CLI_CONSTANT_LIST_INDEX") static boolean isCounterOnly(final TSTable info); static boolean canGenerateMinMaxAvgCount(final TSTable info); static boolean canGenerateCount(final TSTable info); static boolean canGenerateHeatChart(final TSTable info); @JmxExport(description = "generate charts for all measurements") List<String> generateCharts(final int width, final int height); static final int VERSION; }
@Test(expected = IllegalArgumentException.class) public void testWriteBadTSDB() throws Exception { try (TimeSeriesDatabase instance = new TimeSeriesDatabase(new File(FILE_NAME), new byte[]{})) { instance.addTSTable("gr1", new byte[]{}, 5, new String[]{"a", "b"}, new byte[][]{}); instance.addTSTable("gr1", new byte[]{}, 5, new String[]{"a", "b"}, new byte[][]{}); } }