Module org.refcodes.audio
Package org.refcodes.audio
Class AbstractCsvSampleWriter<S extends SoundSample,B extends CsvSampleWriter<S,B>>
java.lang.Object
org.refcodes.audio.AbstractCsvSampleWriter<S,B>
- Type Parameters:
S- TheSoundSample(sub-)type on which theSampleWriterimplementation is to operate on.B- TheCsvSampleWriterimplementing thisAbstractCsvSampleWriter.
- All Implemented Interfaces:
AutoCloseable,CsvSampleWriter<S,,B> SampleWriter<S,,B> SamplingRateAccessor,SamplingRateAccessor.SamplingRateBuilder<B>,SamplingRateAccessor.SamplingRateMutator,SamplingRateAccessor.SamplingRateProperty,org.refcodes.io.RowWriter<S>
- Direct Known Subclasses:
CsvMonoSampleWriter,CsvSoundSampleWriter
public abstract class AbstractCsvSampleWriter<S extends SoundSample,B extends CsvSampleWriter<S,B>>
extends Object
implements CsvSampleWriter<S,B>
The
AbstractCsvSampleWriter provides a foundation to write sound
samples to a CSV file.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.audio.SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.refcodes.tabular.CsvStringRecordWriterprotected CsvDeltaModeprotected boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionAbstractCsvSampleWriter(File aFile) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.AbstractCsvSampleWriter(File aFile, CsvDeltaMode aDeltaMode) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.AbstractCsvSampleWriter(OutputStream aOutputStream) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.AbstractCsvSampleWriter(OutputStream aOutputStream, CsvDeltaMode aDeltaMode) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.AbstractCsvSampleWriter(PrintStream aPrintStream) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.AbstractCsvSampleWriter(PrintStream aPrintStream, CsvDeltaMode aDeltaMode) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.protectedAbstractCsvSampleWriter(org.refcodes.tabular.CsvStringRecordWriter aCsvFriter, CsvDeltaMode aDeltaMode) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected static StringHackishly removes trailing zeros if there is no additional value from them unifying the decimal point.protected static doubleConverts a string to a double by hackishly removing trailing zeros if there is no additional value from them and unifying the decimal point.protected static StringtoString(double aDouble) Converts a double to a string by hackishly removing trailing zeros if there is no additional value from them unifying the decimal point.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.audio.SampleWriter
writeNextMethods inherited from interface org.refcodes.audio.SamplingRateAccessor
getSamplingRateMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateBuilder
withSamplingRateMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateMutator
setSamplingRateMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateProperty
letSamplingRate
-
Field Details
-
_csvWriter
protected org.refcodes.tabular.CsvStringRecordWriter _csvWriter -
_deltaMode
-
_isSamplingRateDirty
protected boolean _isSamplingRateDirty
-
-
Constructor Details
-
AbstractCsvSampleWriter
Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aFile- TheFilewhere to write the CSV records to.- Throws:
FileNotFoundException- If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
-
AbstractCsvSampleWriter
Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aOutputStream- TheOutputStreamwhere to write the CSV records to.
-
AbstractCsvSampleWriter
Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aPrintStream- ThePrintStreamwhere to write the CSV records to.
-
AbstractCsvSampleWriter
Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aFile- TheFilewhere to write the CSV records to.aDeltaMode- TheCsvDeltaModeto use when writing the CSV rows.- Throws:
FileNotFoundException- If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
-
AbstractCsvSampleWriter
Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aOutputStream- TheOutputStreamwhere to write the CSV records to.aDeltaMode- TheCsvDeltaModeto use when writing the CSV rows.
-
AbstractCsvSampleWriter
Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aPrintStream- ThePrintStreamwhere to write the CSV records to.aDeltaMode- TheCsvDeltaModeto use when writing the CSV rows.
-
AbstractCsvSampleWriter
protected AbstractCsvSampleWriter(org.refcodes.tabular.CsvStringRecordWriter aCsvFriter, CsvDeltaMode aDeltaMode) Constructs theAbstractCsvSampleWriterfor writing sound samples to a CSV file or stream.- Parameters:
aCsvFriter- TheCsvStringRecordWriterwith which to write the CSV records with.aDeltaMode- TheCsvDeltaModeto use when writing the CSV rows.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSampleWriter<S extends SoundSample,B extends CsvSampleWriter<S, B>> - Throws:
IOException
-
toString
Converts a double to a string by hackishly removing trailing zeros if there is no additional value from them unifying the decimal point.- Parameters:
aDouble- The double to be converted to a string.- Returns:
- The formatted double without any trailing zeros.
-
toDouble
Converts a string to a double by hackishly removing trailing zeros if there is no additional value from them and unifying the decimal point.- Parameters:
aDouble- The double from which to remove trailing zeros.- Returns:
- The formatted double without any trailing zeros.
-
format
Hackishly removes trailing zeros if there is no additional value from them unifying the decimal point.- Parameters:
aDouble- The double from which to remove trailing zeros.- Returns:
- The formatted double without any trailing zeros.
-