SCCT.JavaSubscriber
Class SCCT_FilePackage

java.lang.Object
  extended by SCCT.JavaSubscriber.SCCT_AbstractPackage
      extended by SCCT.JavaSubscriber.SCCT_AbstractDataPackage
          extended by SCCT.JavaSubscriber.SCCT_FilePackage

public class SCCT_FilePackage
extends SCCT_AbstractDataPackage

This class represents a file package. *This class is available only in PRO version.*


Constructor Summary
SCCT_FilePackage(java.io.File file, boolean md5)
           
SCCT_FilePackage(java.io.File file, java.lang.String[] attributes, boolean md5)
           
SCCT_FilePackage(java.lang.String fileName, byte[] file, java.lang.String[] attributes, boolean md5)
           
 
Method Summary
 java.lang.String[] getAttributes()
          Gets an array of attributes associated with the file.
 byte[] getBytes()
          Gets a sequence of bytes that represents the file.
 java.lang.String getFileName()
          Gets the name of the content file.
 java.lang.String getMd5()
          Gets the md5 of the content file.
 java.io.File saveFile()
          By default the file is saved in the same directory in which the program is running.
 java.io.File saveFile(java.lang.String path)
          By default if a file with the same name already exsists it is overwritten.
 java.io.File saveFile(java.lang.String path, boolean append)
           
 
Methods inherited from class SCCT.JavaSubscriber.SCCT_AbstractDataPackage
getSourceDescription, getSourceId
 
Methods inherited from class SCCT.JavaSubscriber.SCCT_AbstractPackage
getCalendar, getPackageNumber
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCCT_FilePackage

public SCCT_FilePackage(java.lang.String fileName,
                        byte[] file,
                        java.lang.String[] attributes,
                        boolean md5)
Parameters:
fileName - It's the name of the file.
file - It's the file in a byte array.
attributes - It's the array of attributes to send with the file.
md5 - Suggests if calculate the md5 code of file.

SCCT_FilePackage

public SCCT_FilePackage(java.io.File file,
                        java.lang.String[] attributes,
                        boolean md5)
                 throws java.io.IOException
Parameters:
file - It's a File object of java.io package that represents the file to send.
attributes - It's the array of attributes to send with the file.
md5 - Suggests if calculate the md5 code of file.
Throws:
java.io.IOException - If an error occurs, in order to open the file.

SCCT_FilePackage

public SCCT_FilePackage(java.io.File file,
                        boolean md5)
                 throws java.io.IOException
Parameters:
file - It's a File object of java.io package that represent the file to send.
md5 - Suggests if calculate the md5 code of file.
Throws:
java.io.IOException - If an error occurs, in order to open the file.
Method Detail

getFileName

public java.lang.String getFileName()
Gets the name of the content file.

Returns:
The name of the file.

getMd5

public java.lang.String getMd5()
Gets the md5 of the content file.

Returns:
The md5 of the file.

getBytes

public byte[] getBytes()
Gets a sequence of bytes that represents the file.

Returns:
The byte array of the file.

getAttributes

public java.lang.String[] getAttributes()
Gets an array of attributes associated with the file.

Returns:
A string array of attributes.

saveFile

public java.io.File saveFile(java.lang.String path,
                             boolean append)
                      throws java.io.IOException
Parameters:
path - The relative or absolute path where save the file.
For example if the value of this string is "test/" the file will be saved in "test" subdirectory.
append - If true, then bytes will be written to the end of the file rather than the beginning.
Returns:
The File object of the java.io package of the saved file.
Throws:
java.io.IOException - If an error occurs, in order to save the file.

saveFile

public java.io.File saveFile(java.lang.String path)
                      throws java.io.IOException
By default if a file with the same name already exsists it is overwritten.

Parameters:
path - The relative or absolute path where save the file.
For example if the value of this string is "test/" the file will be saved in "test" subdirectory.
Returns:
The File object of the java.io package of the saved file.
Throws:
java.io.IOException - If an error occurs, in order to save the file.

saveFile

public java.io.File saveFile()
                      throws java.io.IOException
By default the file is saved in the same directory in which the program is running. By default if a file with the same name already exsists it is overwritten.

Returns:
The File object of the java.io package of the saved file.
Throws:
java.io.IOException - If an error occurs, in order to save the file.