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(@org.jetbrains.annotations.NotNull byte[] bytes, @NotNull String filename, @Nullable String contentType, @Nullable String attachmentType, boolean addToTransactions) Initializes an Attachment with bytes, a filename, a content type, and addToTransactions.Attachment(@NotNull JsonSerializable serializable, @NotNull String filename, @Nullable String contentType, @Nullable String attachmentType, boolean addToTransactions) Initializes an Attachment with bytes factory, 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.Attachment(@NotNull String pathname, @NotNull String filename, @Nullable String contentType, @Nullable String attachmentType, boolean addToTransactions) Initializes an Attachment with a path, a filename, a content type, and addToTransactions. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull AttachmentfromScreenshot(byte[] screenshotBytes) Creates a new Screenshot Attachmentstatic @NotNull AttachmentfromThreadDump(byte[] bytes) Creates a new Thread Dump Attachmentstatic @NotNull AttachmentfromViewHierarchy(ViewHierarchy viewHierarchy) Creates a new View Hierarchy Attachment@Nullable StringReturns the attachmentType type@org.jetbrains.annotations.Nullable byte[]getBytes()Gets the bytes of the attachment.@Nullable StringGets the content type of the attachment.@NotNull StringGets the name of the attachment to display in Sentry.@Nullable StringGets the pathname string of the attachment.@Nullable JsonSerializableProvides the bytes 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-trueif the SDK should add this attachment to everyITransactionor set tofalseif it shouldn't.
-
Attachment
public Attachment(@NotNull @org.jetbrains.annotations.NotNull byte[] bytes, @NotNull @NotNull String filename, @Nullable @Nullable String contentType, @Nullable @Nullable String attachmentType, 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.attachmentType- the attachment type.addToTransactions-trueif the SDK should add this attachment to everyITransactionor set tofalseif it shouldn't.
-
Attachment
public Attachment(@NotNull @NotNull JsonSerializable serializable, @NotNull @NotNull String filename, @Nullable @Nullable String contentType, @Nullable @Nullable String attachmentType, boolean addToTransactions) Initializes an Attachment with bytes factory, a filename, a content type, and addToTransactions.- Parameters:
serializable- A json serializable holding the attachment payloadfilename- The name of the attachment to display in Sentry.contentType- The content type of the attachment.attachmentType- the attachment type.addToTransactions-trueif the SDK should add this attachment to everyITransactionor set tofalseif 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, @Nullable @Nullable String attachmentType, 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.attachmentType- The attachment type.addToTransactions-trueif the SDK should add this attachment to everyITransactionor set tofalseif it shouldn't.
-
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-trueif the SDK should add this attachment to everyITransactionor set tofalseif 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-trueif the SDK should add this attachment to everyITransactionor set tofalseif 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.
-
getSerializable
Provides the bytes of the attachment.- Returns:
- the bytes factory responsible for providing 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
-
fromViewHierarchy
Creates a new View Hierarchy Attachment- Parameters:
viewHierarchy- the View Hierarchy- Returns:
- the Attachment
-
fromThreadDump
Creates a new Thread Dump Attachment- Parameters:
bytes- the array bytes- Returns:
- the Attachment
-