MPXJ: Microsoft Project Exchange

net.sf.mpxj.mpd
Class MPDUtility

java.lang.Object
  extended by net.sf.mpxj.mpd.MPDUtility

public final class MPDUtility
extends java.lang.Object

This class implements common utility methods used when processing MPD files.


Constructor Summary
MPDUtility()
           
 
Method Summary
static void dumpRow(java.util.Map<java.lang.String,java.lang.Object> row)
          Dump the contents of a row from an MPD file.
static void fileDump(java.lang.String fileName, byte[] data)
          Writes a large byte array to a file.
static void fileHexDump(java.lang.String fileName, byte[] data)
          Writes a hex dump to a file for a large byte array.
static void fileHexDump(java.lang.String fileName, java.io.InputStream is)
          Writes a hex dump to a file from a POI input stream.
static Duration getAdjustedDuration(ProjectFile file, int duration, TimeUnit timeUnit)
          Given a duration and the time units for the duration extracted from an MPP file, this method creates a new Duration to represent the given duration.
static Duration getDuration(double value, TimeUnit type)
          Reads a duration value.
static TimeUnit getDurationTimeUnits(int type)
          This method converts between the duration units representation used in the MPP file, and the standard MPX duration units.
static CurrencySymbolPosition getSymbolPosition(int value)
          This method maps the currency symbol position from the representation used in the MPP file to the representation used by MPX.
static java.lang.String hexdump(byte[] buffer, boolean ascii)
          This method generates a formatted version of the data contained in a byte array.
static java.lang.String hexdump(byte[] buffer, boolean ascii, int columns, java.lang.String prefix)
          This method generates a formatted version of the data contained in a byte array.
static java.lang.String hexdump(byte[] buffer, int offset, int length, boolean ascii)
          This method generates a formatted version of the data contained in a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MPDUtility

public MPDUtility()
Method Detail

getSymbolPosition

public static CurrencySymbolPosition getSymbolPosition(int value)
This method maps the currency symbol position from the representation used in the MPP file to the representation used by MPX.

Parameters:
value - MPP symbol position
Returns:
MPX symbol position

getDurationTimeUnits

public static final TimeUnit getDurationTimeUnits(int type)
This method converts between the duration units representation used in the MPP file, and the standard MPX duration units. If the supplied units are unrecognised, the units default to days.

Parameters:
type - MPP units
Returns:
MPX units

getAdjustedDuration

public static Duration getAdjustedDuration(ProjectFile file,
                                           int duration,
                                           TimeUnit timeUnit)
Given a duration and the time units for the duration extracted from an MPP file, this method creates a new Duration to represent the given duration. This instance has been adjusted to take into account the number of "hours per day" specified for the current project.

Parameters:
file - parent file
duration - duration length
timeUnit - duration units
Returns:
Duration instance

getDuration

public static final Duration getDuration(double value,
                                         TimeUnit type)
Reads a duration value. This method relies on the fact that the units of the duration have been specified elsewhere.

Parameters:
value - Duration value
type - type of units of the duration
Returns:
Duration instance

dumpRow

public static void dumpRow(java.util.Map<java.lang.String,java.lang.Object> row)
Dump the contents of a row from an MPD file.

Parameters:
row - row data

hexdump

public static final java.lang.String hexdump(byte[] buffer,
                                             int offset,
                                             int length,
                                             boolean ascii)
This method generates a formatted version of the data contained in a byte array. The data is written both in hex, and as ASCII characters.

Parameters:
buffer - data to be displayed
offset - offset of start of data to be displayed
length - length of data to be displayed
ascii - flag indicating whether ASCII equivalent chars should also be displayed
Returns:
formatted string

hexdump

public static final java.lang.String hexdump(byte[] buffer,
                                             boolean ascii)
This method generates a formatted version of the data contained in a byte array. The data is written both in hex, and as ASCII characters.

Parameters:
buffer - data to be displayed
ascii - flag indicating whether ASCII equivalent chars should also be displayed
Returns:
formatted string

hexdump

public static final java.lang.String hexdump(byte[] buffer,
                                             boolean ascii,
                                             int columns,
                                             java.lang.String prefix)
This method generates a formatted version of the data contained in a byte array. The data is written both in hex, and as ASCII characters. The data is organised into fixed width columns.

Parameters:
buffer - data to be displayed
ascii - flag indicating whether ASCII equivalent chars should also be displayed
columns - number of columns
prefix - prefix to be added before the start of the data
Returns:
formatted string

fileHexDump

public static final void fileHexDump(java.lang.String fileName,
                                     byte[] data)
Writes a hex dump to a file for a large byte array.

Parameters:
fileName - output file name
data - target data

fileHexDump

public static final void fileHexDump(java.lang.String fileName,
                                     java.io.InputStream is)
Writes a hex dump to a file from a POI input stream. Note that this assumes that the complete size of the data in the stream is returned by the available() method.

Parameters:
fileName - output file name
is - input stream

fileDump

public static final void fileDump(java.lang.String fileName,
                                  byte[] data)
Writes a large byte array to a file.

Parameters:
fileName - output file name
data - target data


Copyright © 2000-2014 Packwood Software. All Rights Reserved.