@ApiStatus.Experimental
public final class Attachment
extends java.lang.Object
Constructor and Description |
---|
Attachment(@NotNull byte[] bytes,
@NotNull java.lang.String filename)
Initializes an Attachment with bytes.
|
Attachment(@NotNull java.lang.String pathname)
Initializes an Attachment with a path.
|
Attachment(@NotNull java.lang.String pathname,
@NotNull java.lang.String filename)
Initializes an Attachment with a path and a filename.
|
Modifier and Type | Method and Description |
---|---|
@Nullable byte[] |
getBytes()
Gets the bytes of the attachment.
|
@NotNull java.lang.String |
getContentType()
Gets the content type of the attachment.
|
@NotNull java.lang.String |
getFilename()
Gets the name of the attachment to display in Sentry.
|
@Nullable java.lang.String |
getPathname()
Gets the pathname string of the attachment.
|
void |
setContentType(@NotNull java.lang.String contentType)
Sets the content type of the attachment.
|
public Attachment(@NotNull @NotNull byte[] bytes, @NotNull @NotNull java.lang.String filename)
bytes
- The bytes of file.filename
- The name of the attachment to display in Sentry.public Attachment(@NotNull @NotNull java.lang.String pathname)
The file located at the pathname is read lazily when the SDK captures an event or transaction not when the attachment is initialized. The pathname string is converted into an abstract pathname before reading the file.
pathname
- The pathname string of the file to upload as an attachment.public Attachment(@NotNull @NotNull java.lang.String pathname, @NotNull @NotNull java.lang.String filename)
The file located at the pathname is read lazily when the SDK captures an event or transaction not when the attachment is initialized. The pathname string is converted into an abstract pathname before reading the file.
pathname
- The pathname string of the file to upload as an attachment.filename
- The name of the attachment to display in Sentry.@Nullable public @Nullable byte[] getBytes()
@Nullable public @Nullable java.lang.String getPathname()
@NotNull public @NotNull java.lang.String getFilename()
@NotNull public @NotNull java.lang.String getContentType()
public void setContentType(@NotNull @NotNull java.lang.String contentType)
contentType
- the content type of the attachment.