www.dextsolution.com
DEXTUPLOAD
NJ
menu toggleReference > devpia > dextuploadnj > BulkSaveOption

devpia.dextuploadnj
Class BulkSaveOption

Minimum version supported
2.7.0
Minimum support environment
JRE 1.6
Description

This is a class that sets options necessary for saving a large number of temporary files.

When saving temporary files using the existing FileUpload.saveAll overloading method, it is recommended to use BulkSaveOption rather than individually setting parameters. All options added after version 2.7.0 will be set only through BulkSaveOption. For example, in the case of an option such as nfc, it can be set only by using BulkSaveOption.

// The old way
fileUpload.saveAll("/home/user/others/", true, true);

// Using BulkSaveOption
BulkSaveOption option = new BulkSaveOption();
option.setTargetDirectoryPath("/home/user/others/");
option.setOverwrite(true);
option.setCopy(true);
fileUpload.saveAll(option);
Constructor

BulkSaveOption

  • Creates an instance of the BulkSaveOption class.
  • Signatures

    public BulkSaveOption()
    public BulkSaveOption(String targetDirectoryPath, boolean overwrite, boolean copy, boolean nfc)
  • Parameters

    Name Type Description
    targetDirectoryPath java.lang.String Directory path to save the file
    overwrite boolean Whether to overwrite duplicate files
    copy boolean Whether to remove temporary files
    nfc boolean Whether to change to Unicode normalization form
Methods

getTargetDirectoryPath

  • Returns the directory path to save the file.
  • Signatures

    public String getTargetDirectoryPath()
  • Returns

    Directory path

setTargetDirectoryPath

  • Sets the directory path to save the file

  • Signatures

    public void setTargetDirectoryPath(String targetDirectoryPath)
  • Parameters

    Name Type Description
    targetDirectoryPath java.lang.String Directory path
  • How to use

    BulkSaveOption option = new BulkSaveOption();
    option.setTargetDirectoryPath("/home/user/others/");

isOverwrite

  • Returns whether or not duplicate files are overwritten.

  • Signatures

    public boolean isOverwrite()
  • Returns

    true or false(default)

setOverwrite

  • Sets whether to overwrite duplicate files.

    When DEXTUploadNJ saves a file, if there are duplicate files with the same file name, the suffix value is automatically appended to the file name. However, in the case of a system that processes many requests at the same time, such as the web, there is a possibility that even the suffix value will be duplicated for a very short time. Therefore, even if the overwrite argument value is false, sometimes file writing may fail. To avoid this situation as much as possible, when saving a file, the file name should be changed to prevent duplicate names from occurring as much as possible without saving the original file name as it is.

  • Signatures

    public void setOverwrite(boolean overwrite)
  • Parameters

    Name Type Description
    overwrite boolean true or false
  • How to use

    BulkSaveOption option = new BulkSaveOption();
    option.setOverwrite(true);

isCopy

  • Returns whether temporary files are removed.

  • Signatures

    public boolean isCopy()
  • Returns

    true or false(default)

setCopy

  • Sets whether to remove temporary files.

    DEXTUploadNJ removes the temporary file immediately after saving the file. Therefore, it cannot be used by calling the FileItem.save method multiple times. If you want to keep the temporary file without deleting it, you can set the copy property to true.

  • Signatures

    public void setCopy(boolean copy)
  • Parameters

    Name Type Description
    copy boolean true or false
  • How to use

    BulkSaveOption option = new BulkSaveOption();
    option.setCopy(true);

isNfc

  • Returns whether the file name is changed to the nfc Unicode normalization form.

  • Signatures

    public boolean isNfc()
  • Returns

    true or false(default)

setNfc

  • Sets whether to change the file name to nfc Unicode normalization form.

    Unlike Windows/Linux, in macOS, file or directory names are managed in the nfd canonical form. For name compatibility between macOS and Windows/Linux, you can set the nfc property to true when nfc changes are required.

  • Signatures

    public void setNfc(boolean nfc)
  • Parameters

    Name Type Description
    nfc boolean true or false
  • How to use

    BulkSaveOption option = new BulkSaveOption();
    option.setNfc(true);