public class DataFile extends Object implements Serializable
Constructor and Description |
---|
DataFile()
Deprecated.
Deprecated for removal.
Use parameterized constructors to create instances that do not need post-construct mutation.
|
DataFile(byte[] data,
String fileName,
String mimeType)
Creates in memory document container.
|
DataFile(InputStream stream,
String fileName,
String mimeType)
Creates in memory document container.
|
DataFile(String path,
String mimeType)
Creates container.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateDigest()
Calculates digest http://www.w3.org/2001/04/xmlenc#sha256 for the data file.
|
byte[] |
calculateDigest(DigestAlgorithm digestType) |
byte[] |
calculateDigest(URL method)
Calculates digest for data file.
|
byte[] |
getBytes()
Gives file bytes
|
eu.europa.esig.dss.model.DSSDocument |
getDocument() |
long |
getFileSize()
Returns the data file size.
|
String |
getId()
Returns file ID
For BDoc it will return the filename
|
String |
getMediaType()
Returns the file media type.
|
String |
getName()
Returns the data file name.
|
InputStream |
getStream()
Gives data file as stream
|
boolean |
isFileEmpty()
Returns
true if the data file size is 0 bytes. |
void |
saveAs(OutputStream out)
Saves a copy of the data file as a file to the specified stream.
|
void |
saveAs(String path)
Saves a copy of the data file as a file with the specified file name.
|
void |
setDocument(eu.europa.esig.dss.model.DSSDocument document)
Deprecated.
Deprecated for removal.
Use parameterized constructors to create instances that do not need post-construct mutation.
|
void |
setId(String dataFileId)
Set id for the dataFile (DDoc usage only)
|
void |
setMediaType(String mediaType)
Deprecated.
Deprecated for removal.
Use parameterized constructors to create instances that do not need post-construct mutation.
|
public DataFile(String path, String mimeType)
path
- file name with pathmimeType
- MIME type of the data file, for example 'text/plain' or 'application/msword'public DataFile(byte[] data, String fileName, String mimeType)
data
- file contentfileName
- file name with pathmimeType
- MIME type of the data file, for example 'text/plain' or 'application/msword'public DataFile(InputStream stream, String fileName, String mimeType)
stream
- file content from streamfileName
- file name with pathmimeType
- MIME type of the stream file, for example 'text/plain' or 'application/msword'@Deprecated public DataFile()
public byte[] calculateDigest()
public byte[] calculateDigest(URL method)
Supported uris for BDoc:
In case of DDoc files the parameter is ignored and SHA1 hash is always returned
method
- method uri for calculating the digestpublic byte[] calculateDigest(DigestAlgorithm digestType)
digestType
- digest algorithm typepublic String getName()
public String getId()
public long getFileSize()
public boolean isFileEmpty()
true
if the data file size is 0 bytes.true
if the data file is emptypublic String getMediaType()
@Deprecated public void setMediaType(String mediaType)
public void saveAs(OutputStream out) throws IOException
out
- stream where data is written toIOException
- on file write errorpublic void saveAs(String path)
path
- full file path where the data file should be saved to. If the file exists it will be overwrittenpublic byte[] getBytes()
public InputStream getStream()
public void setId(String dataFileId)
dataFileId
- id for the dataFilepublic eu.europa.esig.dss.model.DSSDocument getDocument()
@Deprecated public void setDocument(eu.europa.esig.dss.model.DSSDocument document)
Copyright © 2024. All rights reserved.