java.lang.Object
it.auties.whatsapp.util.Medias
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final record
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final HttpClient
private static final String
private static final int
private static final int
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]
calculateMac
(byte[] encryptedMedia, MediaKeys keys) static String
createMediaUrl
(String directPath) private static Path
createTempFile
(byte[] data) static Optional
<byte[]> static CompletableFuture
<Optional<byte[]>> downloadAsync
(MutableAttachmentProvider<?> provider) static CompletableFuture
<byte[]> downloadAsync
(URI imageUri) private static CompletableFuture
<byte[]> downloadAsync
(URI imageUri, boolean userAgent) static Optional
<byte[]> getAudioWaveForm
(byte[] audioData) static MediaDimensions
getDimensions
(byte[] file, boolean video) static int
getDuration
(byte[] file) getExtension
(String name) private static Optional
<byte[]> getImageThumbnail
(byte[] file, Medias.Format format) getMimeType
(byte[] media) getMimeType
(String name) getMimeType
(Path path) static OptionalInt
getPagesCount
(byte[] file, String fileType) private static Optional
<byte[]> getPdfThumbnail
(byte[] file) private static Optional
<byte[]> getPresentationThumbnail
(byte[] file) static byte[]
getProfilePic
(byte[] file) static Optional
<byte[]> getThumbnail
(byte[] file, Medias.Format format) static Optional
<byte[]> getThumbnail
(byte[] file, String fileType) private static Optional
<byte[]> getVideoThumbnail
(byte[] file) private static Optional
<byte[]> handleResponse
(MutableAttachmentProvider<?> provider, HttpResponse<byte[]> response) private static MediaFile
prepareMediaFile
(AttachmentType type, byte[] uploadData) private static float[]
toFloatArray
(byte[] audioData) static CompletableFuture
<MediaFile> upload
(byte[] file, AttachmentType type, MediaConnection mediaConnection)
-
Field Details
-
CLIENT
-
PROFILE_PIC_SIZE
private static final int PROFILE_PIC_SIZE- See Also:
-
DEFAULT_HOST
- See Also:
-
THUMBNAIL_SIZE
private static final int THUMBNAIL_SIZE- See Also:
-
USER_AGENT
- See Also:
-
-
Constructor Details
-
Medias
public Medias()
-
-
Method Details
-
getProfilePic
public static byte[] getProfilePic(byte[] file) -
download
-
downloadAsync
-
downloadAsync
-
upload
public static CompletableFuture<MediaFile> upload(byte[] file, AttachmentType type, MediaConnection mediaConnection) -
prepareMediaFile
-
calculateMac
-
downloadAsync
public static CompletableFuture<Optional<byte[]>> downloadAsync(MutableAttachmentProvider<?> provider) -
createMediaUrl
-
handleResponse
private static Optional<byte[]> handleResponse(MutableAttachmentProvider<?> provider, HttpResponse<byte[]> response) -
getMimeType
-
getExtension
-
getMimeType
-
getMimeType
-
getPagesCount
-
getDuration
public static int getDuration(byte[] file) -
getDimensions
-
createTempFile
-
getThumbnail
-
getThumbnail
-
getImageThumbnail
-
getVideoThumbnail
-
getPdfThumbnail
-
getPresentationThumbnail
-
getAudioWaveForm
-
toFloatArray
private static float[] toFloatArray(byte[] audioData)
-