com.altair.hwm.beans.utils
Class HWMFileDataSource

java.lang.Object
  extended by javax.activation.FileDataSource
      extended by com.altair.hwm.beans.utils.HWMFileDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class HWMFileDataSource
extends javax.activation.FileDataSource

Title: HWMFileDataSource

Description: This data source will take in a file and when an input stream is required, it will return a GZipInputStream

Company: Altair Engineering, Inc.


Constructor Summary
HWMFileDataSource(java.io.File file, boolean bCompress)
          Constructor
 
Method Summary
 java.lang.String getContentType()
          get the content type
 java.io.File getFile()
          Get the file object
 java.io.InputStream getInputStream()
          Get the inputstream for the file
 java.lang.String getName()
          Returns the name of the file
 java.io.OutputStream getOutputStream()
          Get the outputstream for the file
 void setFileTypeMap(javax.activation.FileTypeMap fileMap)
          Set the file type map
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HWMFileDataSource

public HWMFileDataSource(java.io.File file,
                         boolean bCompress)
Constructor

Parameters:
file - The file for which this acts like a source
bCompress - If true, the file is compressed
Method Detail

getContentType

public java.lang.String getContentType()
get the content type

Specified by:
getContentType in interface javax.activation.DataSource
Overrides:
getContentType in class javax.activation.FileDataSource
Returns:
String The content type

getFile

public java.io.File getFile()
Get the file object

Overrides:
getFile in class javax.activation.FileDataSource
Returns:
file The file object

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get the outputstream for the file

Specified by:
getOutputStream in interface javax.activation.DataSource
Overrides:
getOutputStream in class javax.activation.FileDataSource
Returns:
OutputStream The output stream for the file
Throws:
java.io.IOException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get the inputstream for the file

Specified by:
getInputStream in interface javax.activation.DataSource
Overrides:
getInputStream in class javax.activation.FileDataSource
Returns:
InputStream The input stream for the file
Throws:
java.io.IOException

setFileTypeMap

public void setFileTypeMap(javax.activation.FileTypeMap fileMap)
Set the file type map

Overrides:
setFileTypeMap in class javax.activation.FileDataSource
Parameters:
fileMao - The file type map for this file

getName

public java.lang.String getName()
Returns the name of the file

Specified by:
getName in interface javax.activation.DataSource
Overrides:
getName in class javax.activation.FileDataSource
Returns:
String The name of the file