de.dfki.lt.mary.unitselection.voiceimport
Class MaryHeader

java.lang.Object
  extended by de.dfki.lt.mary.unitselection.voiceimport.MaryHeader

public class MaryHeader
extends java.lang.Object

Common helper class to read/write a standard Mary header to/from the various Mary data files.

Author:
sacha

Field Summary
static int CARTS
           
static int HALFPHONE_UNITFEATS
           
static int JOINFEATS
           
static int PRECOMPUTED_JOINCOSTS
           
static int TIMELINE
           
static int UNITFEATS
           
static int UNITS
           
static int UNKNOWN
           
 
Constructor Summary
MaryHeader(java.io.DataInput input)
          File constructor
MaryHeader(int newType)
          Plain constructor
 
Method Summary
 long getByteSize()
           
 int getMagic()
           
 int getType()
           
 int getVersion()
           
 boolean hasBadType()
           
 boolean hasCurrentVersion()
           
 boolean hasLegalMagic()
           
 boolean hasLegalType()
           
 boolean isMaryHeader()
           
 long load(java.io.DataInput input)
          Static Mary header writer
static int peekFileType(java.lang.String fileName)
          For the given file, look inside and determine the file type.
 long writeTo(java.io.DataOutput output)
          Static Mary header writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

CARTS

public static final int CARTS
See Also:
Constant Field Values

UNITS

public static final int UNITS
See Also:
Constant Field Values

UNITFEATS

public static final int UNITFEATS
See Also:
Constant Field Values

HALFPHONE_UNITFEATS

public static final int HALFPHONE_UNITFEATS
See Also:
Constant Field Values

JOINFEATS

public static final int JOINFEATS
See Also:
Constant Field Values

PRECOMPUTED_JOINCOSTS

public static final int PRECOMPUTED_JOINCOSTS
See Also:
Constant Field Values

TIMELINE

public static final int TIMELINE
See Also:
Constant Field Values
Constructor Detail

MaryHeader

public MaryHeader(int newType)
Plain constructor

Parameters:
newType - The standard type of the Mary file, to be chosen among: MaryHeader.CARTS, MaryHeader.UNITS, MaryHeader.UNITFEATS, MaryHeader.JOINFEATS, MaryHeader.TIMELINE.
Throws:
java.lang.RuntimeException - if the input type is unknown.

MaryHeader

public MaryHeader(java.io.DataInput input)
           throws java.io.IOException
File constructor

Parameters:
input - a DataInputStream or RandomAccessFile to read the header from.
Throws:
java.io.IOException - if the input type is unknown.
Method Detail

peekFileType

public static int peekFileType(java.lang.String fileName)
                        throws java.io.IOException
For the given file, look inside and determine the file type.

Parameters:
fileName -
Throws:
java.io.IOException - if the file is not a MARY file.

writeTo

public long writeTo(java.io.DataOutput output)
             throws java.io.IOException
Static Mary header writer

Parameters:
output - The DataOutputStream or RandomAccessFile to write to
Returns:
the number of written bytes.
Throws:
java.io.IOException - if the file type is unknown.

load

public long load(java.io.DataInput input)
          throws java.io.IOException
Static Mary header writer

Parameters:
input - The data input (DataInputStream or RandomAccessFile) to read from.
Returns:
the number of read bytes.
Throws:
java.io.IOException - (forwarded from the random access file read operations)

getMagic

public int getMagic()

getVersion

public int getVersion()

getType

public int getType()

getByteSize

public long getByteSize()

hasLegalMagic

public boolean hasLegalMagic()

hasCurrentVersion

public boolean hasCurrentVersion()

hasBadType

public boolean hasBadType()

hasLegalType

public boolean hasLegalType()

isMaryHeader

public boolean isMaryHeader()