Skip to content

Commit 35a2b1d

Browse files
Add docs
1 parent 56910f2 commit 35a2b1d

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/main/java/org/radarcns/util/CsvAvroConverter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.io.IOException;
3131
import java.io.Writer;
3232
import java.nio.ByteBuffer;
33+
import java.util.Iterator;
3334
import java.util.LinkedHashMap;
3435
import java.util.List;
3536
import java.util.Map;
@@ -59,7 +60,7 @@ public boolean hasHeader() {
5960
private final ObjectWriter csvWriter;
6061
private final Map<String, Object> map;
6162
private final CsvGenerator generator;
62-
private int numOfColumns;
63+
private final int numOfColumns;
6364

6465
public CsvAvroConverter(CsvFactory factory, Writer writer, GenericRecord record, boolean writeHeader)
6566
throws IOException {
@@ -78,6 +79,12 @@ public CsvAvroConverter(CsvFactory factory, Writer writer, GenericRecord record,
7879
csvWriter = new CsvMapper(factory).writer(schema);
7980
}
8081

82+
/**
83+
* Write AVRO record to CSV file.
84+
* @param record the AVRO record to be written to CSV file
85+
* @return true if write was successful, false if cannot write record to the current CSV file
86+
* @throws IOException for other IO and Mapping errors
87+
*/
8188
@Override
8289
public boolean writeRecord(GenericRecord record) throws IOException {
8390
Map<String, Object> localMap = convertRecord(record);

src/main/java/org/radarcns/util/FileCache.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ public FileCache(RecordConverterFactory converterFactory, Path path,
7676
}
7777
}
7878

79-
/** Write a record to the cache. */
79+
/**
80+
* Write a record to the cache.
81+
* @param record AVRO record
82+
* @return true or false based on {@link RecordConverter} write result
83+
* @throws IOException
84+
*/
8085
public boolean writeRecord(GenericRecord record) throws IOException {
8186
boolean result = this.recordConverter.writeRecord(record);
8287
lastUse = System.nanoTime();

src/main/java/org/radarcns/util/FileCacheStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public FileCacheStore(RecordConverterFactory converterFactory, int maxFiles, boo
6161
*
6262
* @param path file to append data to
6363
* @param record data
64-
* @return integer according to one of the response codes.
64+
* @return Integer value according to one of the response codes.
6565
* @throws IOException when failing to open a file or writing to it.
6666
*/
6767
public int writeRecord(Path path, GenericRecord record) throws IOException {

0 commit comments

Comments
 (0)