marf.Storage.Loaders
Class TextLoader

java.lang.Object
  extended by marf.Storage.SampleLoader
      extended by marf.Storage.Loaders.TextLoader
All Implemented Interfaces:
ISampleLoader

public class TextLoader
extends SampleLoader

Loads text samples assuming character code to be the absolute value.

$Id: TextLoader.java,v 1.3 2008/02/16 02:07:57 mokhov Exp $

Since:
0.3.0.6
Version:
$Revision: 1.3 $
Author:
Serguei Mokhov

Field Summary
protected  int iNgramCalculationModel
          Has effect with n-grams with n > 1.
protected  int iNgramEndiness
          Indicates whether to interpret little or big endianness.
protected  int iNgramModel
          Amount of characters per sample point.
protected  int iPowerBase
          Amplitude numerical base interpretation.
static int NGRAM_ARITHMETIC_ADD
           
static int NGRAM_ARITHMETIC_POWER_ADD
           
static int NGRAM_BIG_ENDIAN
           
static int NGRAM_LITTLE_ENDIAN
           
static int NGRAM_LOGICAL_OR
           
protected  java.io.Reader oReader
          Internal text reader object reference.
static int POWER_BASE_64
           
static int POWER_BASE_ASCIICIMAL
           
static int POWER_BASE_BINARY
           
static int POWER_BASE_BYTECIMAL
           
static int POWER_BASE_DECIMAL
           
static int POWER_BASE_HEXADECIMAL
           
static int POWER_BASE_OCTAL
           
 
Fields inherited from class marf.Storage.SampleLoader
fRequiredFrequency, iRequiredBitSize, iRequiredChannels, oByteArrayOutputStream, oSample
 
Fields inherited from interface marf.Storage.ISampleLoader
DEFAULT_CHANNELS, DEFAULT_FREQUENCY, DEFAULT_SAMPLE_BIT_SIZE, MARF_INTERFACE_CODE_REVISION
 
Constructor Summary
TextLoader()
          Constructs default Text Loader.
 
Method Summary
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 long getSampleSize()
          Retrieves the length of the sample (# of data points in the stream).
 Sample loadSample(java.io.InputStream poDataInputStream)
          Not implemented.
 int readSampleData(double[] padSampleData)
          Reads of the next chunk of character data as amplitudes.
 int writeSampleData(double[] padSample, int piLength)
          TODO: Does not do any actual writing.
 
Methods inherited from class marf.Storage.SampleLoader
getRequiredBitSize, getRequiredChannels, getRequiredFrequency, getSample, loadSample, loadSample, loadSample, reset, saveSample, saveSample, saveSample, saveSample, setRequiredBitSize, setRequiredChannels, setRequiredFrequency, setSample, updateSample
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iNgramModel

protected int iNgramModel
Amount of characters per sample point.


NGRAM_LOGICAL_OR

public static final int NGRAM_LOGICAL_OR
See Also:
Constant Field Values

NGRAM_ARITHMETIC_ADD

public static final int NGRAM_ARITHMETIC_ADD
See Also:
Constant Field Values

NGRAM_ARITHMETIC_POWER_ADD

public static final int NGRAM_ARITHMETIC_POWER_ADD
See Also:
Constant Field Values

iNgramCalculationModel

protected int iNgramCalculationModel
Has effect with n-grams with n > 1.


NGRAM_LITTLE_ENDIAN

public static final int NGRAM_LITTLE_ENDIAN
See Also:
Constant Field Values

NGRAM_BIG_ENDIAN

public static final int NGRAM_BIG_ENDIAN
See Also:
Constant Field Values

iNgramEndiness

protected int iNgramEndiness
Indicates whether to interpret little or big endianness. Has only effect with n-grams with n > 1.


POWER_BASE_DECIMAL

public static final int POWER_BASE_DECIMAL
See Also:
Constant Field Values

POWER_BASE_OCTAL

public static final int POWER_BASE_OCTAL
See Also:
Constant Field Values

POWER_BASE_HEXADECIMAL

public static final int POWER_BASE_HEXADECIMAL
See Also:
Constant Field Values

POWER_BASE_BINARY

public static final int POWER_BASE_BINARY
See Also:
Constant Field Values

POWER_BASE_64

public static final int POWER_BASE_64
See Also:
Constant Field Values

POWER_BASE_ASCIICIMAL

public static final int POWER_BASE_ASCIICIMAL
See Also:
Constant Field Values

POWER_BASE_BYTECIMAL

public static final int POWER_BASE_BYTECIMAL
See Also:
Constant Field Values

iPowerBase

protected int iPowerBase
Amplitude numerical base interpretation. Has only effect with power add n-grams with n > 1.


oReader

protected java.io.Reader oReader
Internal text reader object reference.

Constructor Detail

TextLoader

public TextLoader()
           throws InvalidSampleFormatException
Constructs default Text Loader.

Throws:
InvalidSampleFormatException
Method Detail

readSampleData

public final int readSampleData(double[] padSampleData)
                         throws StorageException
Reads of the next chunk of character data as amplitudes.

Parameters:
padSampleData - to fill in with sample data
Returns:
the length of padSampleData
Throws:
StorageException
See Also:
AudioSampleLoader.readAudioData(double[])

writeSampleData

public final int writeSampleData(double[] padSample,
                                 int piLength)
                          throws StorageException
TODO: Does not do any actual writing.

Parameters:
padSample - used to verify the length
piLength - used to verify the length
Returns:
the smallest of padSample.length or piLength
Throws:
StorageException - if piLength is less than zero
See Also:
AudioSampleLoader.writeAudioData(double[], int)

loadSample

public Sample loadSample(java.io.InputStream poDataInputStream)
                  throws StorageException
Description copied from class: SampleLoader
Not implemented. Must be overridden to work.

Specified by:
loadSample in interface ISampleLoader
Overrides:
loadSample in class SampleLoader
Parameters:
poDataInputStream - the stream of a sample to be read from
Returns:
Sample object reference
Throws:
StorageException - if there was an error loading the sample
See Also:
ISampleLoader.loadSample(java.io.InputStream)

getSampleSize

public long getSampleSize()
                   throws StorageException
Retrieves the length of the sample (# of data points in the stream).

Specified by:
getSampleSize in interface ISampleLoader
Overrides:
getSampleSize in class SampleLoader
Returns:
sample size, long
Throws:
StorageException - if there was an error getting sample size

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string


SourceForge Logo