public class CSVTool
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
boolean |
runningFromConsole |
Constructor and Description |
---|
CSVTool() |
Modifier and Type | Method and Description |
---|---|
java.io.ByteArrayOutputStream |
convertCsvToFit(java.io.ByteArrayInputStream byteArrayInputStream)
Converts the given CSV file to a FIT file.
|
java.io.ByteArrayOutputStream |
convertFitToCsv(java.io.ByteArrayInputStream byteArrayInputStream)
Converts the given FIT file to a CSV.
|
void |
enableBytesAsHex(boolean enable)
Output byte values and arrays to hexadecimal values.
|
void |
enableCheckIntegrity(boolean enable)
Check the integrity of the FIT file before decoding and converting it to a CSV file.
|
void |
enableDateTimeAsISO8601(boolean enable)
Output date-time values as ISO-8601 formatted strings.
|
void |
enableEnumsAsStrings(boolean enable)
Output enum values as their corresponding string labels when possible.
|
void |
enableFitSdkDebugging(boolean enable)
Enable debugging print statements when decoding and encoding using the FIT SDK.
|
void |
enableGenerateDataFile(boolean enable)
Generate a data file during conversion from FIT to CSV.
|
void |
enableHideUnknownData(boolean enable)
Hide unknown data and save the number of unknown values and messages encountered.
|
void |
enableRemoveExpandedFields(boolean enable)
Remove expanded fields from CSV output.
|
void |
enableSemicirclesAsDegrees(boolean enable)
Output semicircle values as degrees.
|
void |
enableShowInvalidsAsEmpty(boolean enable)
Show invalid field values as empty cells in the CSV output.
|
void |
enableShowInvalidValues(boolean enable)
Show invalid field values in the CSV output.
|
void |
enableVerificationTests(boolean enable)
Enable running file verification tests while decoding a FIT file.
|
java.io.ByteArrayOutputStream |
getByteArrayOutputStream() |
java.util.HashSet<java.lang.String> |
getDataMessagesFilter() |
java.io.ByteArrayOutputStream |
getDataWriterByteArrayOutputStream() |
java.util.HashSet<java.lang.String> |
getMesgDefinitionsFilter() |
int |
getNumUnknownFields() |
int |
getNumUnknownMesgs() |
Fit.ProtocolVersion |
getProtocolVersion() |
boolean |
isBytesAsHexEnabled() |
boolean |
isCheckIntegrityEnabled() |
boolean |
isDateTimeAsISO8601Enabled() |
boolean |
isEnumsAsStringsEnabled() |
boolean |
isExcludeMesgListEnabled()
Changes the behaviour of the MesgDefinitionFilter and DataMessagesFilter options to
filter out the messages listed.
|
boolean |
isFitSdkDebugEnabled() |
boolean |
isGenerateDataFileEnabled() |
boolean |
isHideUnknownDataEnabled() |
boolean |
isRemoveExpandedFieldsEnabled() |
boolean |
isSemicirclesAsDegreesEnabled() |
boolean |
isShowInvalidsAsEmptyEnabled() |
boolean |
isShowInvalidValuesEnabled() |
boolean |
isVerificationTestsEnabled() |
static void |
main(java.lang.String[] args) |
void |
setDataMessagesFilter(java.util.HashSet<java.lang.String> dataMessagesToOutput)
Sets the list of messages to filter from the FIT file when decoding.
|
void |
setExcludeMesgList(boolean excludeMesgList)
Sets message filter list to be interpreted as messages and definitions to exclude during conversion.
|
void |
setMesgDefinitionFilter(java.util.HashSet<java.lang.String> mesgDefinitionsToOutput)
Sets the list of message definitions to filter from the FIT file when decoding.
|
void |
setProtocolVersion(Fit.ProtocolVersion protocolVersion)
Encode file using the given Protocol Version.
|
public static void main(java.lang.String[] args)
public java.io.ByteArrayOutputStream convertFitToCsv(java.io.ByteArrayInputStream byteArrayInputStream) throws java.lang.Exception
byteArrayInputStream
- a java.io.ByteArrayInputStream of the given FIT filejava.lang.Exception
- if an error occurs while decoding a FIT file to a CSV filepublic java.io.ByteArrayOutputStream convertCsvToFit(java.io.ByteArrayInputStream byteArrayInputStream) throws java.lang.Exception
byteArrayInputStream
- a java.io.ByteArrayInputStream of the given CSV filejava.lang.Exception
- if an error occurs while encoding a CSV file to a FIT filepublic java.io.ByteArrayOutputStream getByteArrayOutputStream()
public java.io.ByteArrayOutputStream getDataWriterByteArrayOutputStream()
public void setProtocolVersion(Fit.ProtocolVersion protocolVersion)
protocolVersion
- the protocol version to use when encoding filespublic Fit.ProtocolVersion getProtocolVersion()
public void setMesgDefinitionFilter(java.util.HashSet<java.lang.String> mesgDefinitionsToOutput)
Note: if excludeMesgList is set to "true", this list is all the messages to exclude. Default behavior is inclusive.
mesgDefinitionsToOutput
- a map of message definitions to filter when decoding a filepublic java.util.HashSet<java.lang.String> getMesgDefinitionsFilter()
Note: if excludeMesgList is set to "true", this list is all the messages to exclude. Default behavior is inclusive
public void setDataMessagesFilter(java.util.HashSet<java.lang.String> dataMessagesToOutput)
Note: if excludeMesgList is set to "true", this list is all the messages to exclude. Default behavior is inclusive.
dataMessagesToOutput
- a map of data messages to filter when decoding a filepublic java.util.HashSet<java.lang.String> getDataMessagesFilter()
Note: if excludeMesgList is set to "true", this list is all the messages to exclude. Default behavior is inclusive
public int getNumUnknownFields()
public int getNumUnknownMesgs()
public void enableHideUnknownData(boolean enable)
enable
- if true then unknown data will be hidden; if false then unknown data will be shownpublic boolean isHideUnknownDataEnabled()
public void enableGenerateDataFile(boolean enable)
enable
- if true then a data file will be generated; if false then a data file will not be generatedpublic boolean isGenerateDataFileEnabled()
public void enableVerificationTests(boolean enable)
enable
- if true then verification tests will be run; if false tests will not be runpublic boolean isVerificationTestsEnabled()
public void enableBytesAsHex(boolean enable)
enable
- if true then byte values will be output as hexadecimal values; if false byte values will be output as decimalspublic boolean isBytesAsHexEnabled()
public void enableDateTimeAsISO8601(boolean enable)
enable
- if true date-time values will be output as ISO-8601 formatted strings; if false date times will be output as FIT timestampspublic boolean isDateTimeAsISO8601Enabled()
public void enableSemicirclesAsDegrees(boolean enable)
enable
- if true semicircle values will be output as degrees; if false semicircle values will remain unchangedpublic boolean isSemicirclesAsDegreesEnabled()
public void enableCheckIntegrity(boolean enable)
enable
- if true the integrity of the FIT file will be checked before converting it to a CSV file; if false the file integrity will not be checkedpublic boolean isCheckIntegrityEnabled()
public void enableShowInvalidValues(boolean enable)
enable
- if true the invalid values will be included in the output CSV; if false invalid values will not be included in the output CSVpublic boolean isShowInvalidValuesEnabled()
public void enableShowInvalidsAsEmpty(boolean enable)
enable
- if true invalid values will be shown as empty cells in the output CSV; if false cells with invalid values will not be included in the output CSVpublic boolean isShowInvalidsAsEmptyEnabled()
public void enableEnumsAsStrings(boolean enable)
Note: CSV files generated with this option will not be able to be converted back into .FIT files.
enable
- if true invalid enum values will be output as strings; if false enum values will be output as numeric valuespublic boolean isEnumsAsStringsEnabled()
public void enableRemoveExpandedFields(boolean enable)
enable
- if true expanded fields will not be shown in the CSV output; if false expanded fields will be shown in the CSV outputpublic boolean isRemoveExpandedFieldsEnabled()
public void setExcludeMesgList(boolean excludeMesgList)
excludeMesgList
- if true the MesgDefinitionFilter list and DataMessagesFilter list will exclude all provided messages from CSV output; if false the filters will exclude all messages not specified in the filter listspublic boolean isExcludeMesgListEnabled()
public void enableFitSdkDebugging(boolean enable)
Note: This will slow down the CSVTool and prints numerous messages to the console.
enable
- if true debug statements will be printed to the console; if false debug statements will not be printed to the consolepublic boolean isFitSdkDebugEnabled()
Note: This will slow down the CSVTool and prints numerous messages to the console