Class Attachment
-
Constructor Summary
ConstructorsConstructorDescriptionAttachment
(@org.jetbrains.annotations.NotNull byte[] bytes, @NotNull String filename) Initializes an Attachment with bytes and a filename.Attachment
(@org.jetbrains.annotations.NotNull byte[] bytes, @NotNull String filename, @Nullable String contentType) Initializes an Attachment with bytes, a filename, and a content type.Attachment
(@org.jetbrains.annotations.NotNull byte[] bytes, @NotNull String filename, @Nullable String contentType, boolean addToTransactions) Initializes an Attachment with bytes, a filename, a content type, and addToTransactions.Attachment
(@NotNull String pathname) Initializes an Attachment with a path.Attachment
(@NotNull String pathname, @NotNull String filename) Initializes an Attachment with a path and a filename.Attachment
(@NotNull String pathname, @NotNull String filename, @Nullable String contentType) Initializes an Attachment with a path, a filename, and a content type.Attachment
(@NotNull String pathname, @NotNull String filename, @Nullable String contentType, boolean addToTransactions) Initializes an Attachment with a path, a filename, a content type, and addToTransactions.Attachment
(@NotNull String pathname, @NotNull String filename, @Nullable String contentType, boolean addToTransactions, @Nullable String attachmentType) Initializes an Attachment with a path, a filename, a content type, addToTransactions, and attachmentType. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Attachment
fromScreenshot
(byte[] screenshotBytes) Creates a new Screenshot Attachment@Nullable String
Returns the attachmentType type@org.jetbrains.annotations.Nullable byte[]
getBytes()
Gets the bytes of the attachment.@Nullable String
Gets the content type of the attachment.@NotNull String
Gets the name of the attachment to display in Sentry.@Nullable String
Gets the pathname string of the attachment.
-
Constructor Details
-
Attachment
public Attachment(@NotNull @org.jetbrains.annotations.NotNull byte[] bytes, @NotNull @NotNull String filename) Initializes an Attachment with bytes and a filename. Sets addToTransaction tofalse
.- Parameters:
bytes
- The bytes of file.filename
- The name of the attachment to display in Sentry.
-
Attachment
public Attachment(@NotNull @org.jetbrains.annotations.NotNull byte[] bytes, @NotNull @NotNull String filename, @Nullable @Nullable String contentType) Initializes an Attachment with bytes, a filename, and a content type. Sets addToTransaction tofalse
.- Parameters:
bytes
- The bytes of file.filename
- The name of the attachment to display in Sentry.contentType
- The content type of the attachment.
-
Attachment
public Attachment(@NotNull @org.jetbrains.annotations.NotNull byte[] bytes, @NotNull @NotNull String filename, @Nullable @Nullable String contentType, boolean addToTransactions) Initializes an Attachment with bytes, a filename, a content type, and addToTransactions.- Parameters:
bytes
- The bytes of file.filename
- The name of the attachment to display in Sentry.contentType
- The content type of the attachment.addToTransactions
-true
if the SDK should add this attachment to everyITransaction
or set tofalse
if it shouldn't.
-
Attachment
Initializes an Attachment with a path. The filename of the file located at the path is used. Sets addToTransaction tofalse
.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.
- Parameters:
pathname
- The pathname string of the file to upload as an attachment.
-
Attachment
Initializes an Attachment with a path and a filename. Sets addToTransaction tofalse
.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.
- Parameters:
pathname
- The pathname string of the file to upload as an attachment.filename
- The name of the attachment to display in Sentry.
-
Attachment
public Attachment(@NotNull @NotNull String pathname, @NotNull @NotNull String filename, @Nullable @Nullable String contentType) Initializes an Attachment with a path, a filename, and a content type. Sets addToTransaction tofalse
.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.
- Parameters:
pathname
- The pathname string of the file to upload as an attachment.filename
- The name of the attachment to display in Sentry.contentType
- The content type of the attachment.
-
Attachment
public Attachment(@NotNull @NotNull String pathname, @NotNull @NotNull String filename, @Nullable @Nullable String contentType, boolean addToTransactions) Initializes an Attachment with a path, a filename, a content type, and addToTransactions.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.
- Parameters:
pathname
- The pathname string of the file to upload as an attachment.filename
- The name of the attachment to display in Sentry.contentType
- The content type of the attachment.addToTransactions
-true
if the SDK should add this attachment to everyITransaction
or set tofalse
if it shouldn't.
-
Attachment
public Attachment(@NotNull @NotNull String pathname, @NotNull @NotNull String filename, @Nullable @Nullable String contentType, boolean addToTransactions, @Nullable @Nullable String attachmentType) Initializes an Attachment with a path, a filename, a content type, addToTransactions, and attachmentType.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.
- Parameters:
pathname
- The pathname string of the file to upload as an attachment.filename
- The name of the attachment to display in Sentry.contentType
- The content type of the attachment.addToTransactions
-true
if the SDK should add this attachment to everyITransaction
or set tofalse
if it shouldn't.attachmentType
- The content type of the attachment.
-
-
Method Details
-
getBytes
@Nullable public @org.jetbrains.annotations.Nullable byte[] getBytes()Gets the bytes of the attachment.- Returns:
- the bytes.
-
getPathname
Gets the pathname string of the attachment.- Returns:
- the pathname string.
-
getFilename
Gets the name of the attachment to display in Sentry.- Returns:
- the filename.
-
getContentType
Gets the content type of the attachment. The server infers "application/octet-stream" if not set.- Returns:
- the content type or null if not set.
-
getAttachmentType
Returns the attachmentType type- Returns:
- the attachmentType
-
fromScreenshot
Creates a new Screenshot Attachment- Parameters:
screenshotBytes
- the array bytes- Returns:
- the Attachment
-