java.lang.Object
it.auties.whatsapp.util.Medias
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final HttpClientprivate static final Stringprivate static final intprivate static final intprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]calculateMac(byte[] encryptedMedia, MediaKeys keys) static StringcreateMediaUrl(String directPath) private static PathcreateTempFile(byte[] data) static CompletableFuture<Optional<byte[]>> downloadAsync(MutableAttachmentProvider<?> provider) static CompletableFuture<byte[]> static CompletableFuture<byte[]> downloadAsync(URI uri, Map.Entry<String, String>... headers) static Optional<byte[]> getAudioWaveForm(byte[] audioData) static MediaDimensionsgetDimensions(byte[] file, boolean video) static intgetDuration(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 OptionalIntgetPagesCount(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 MediaFileprepareMediaFile(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) -
downloadAsync
@SafeVarargs public static CompletableFuture<byte[]> downloadAsync(URI uri, Map.Entry<String, String>... headers) -
downloadAsync
@SafeVarargs public static CompletableFuture<byte[]> downloadAsync(URI uri, String userAgent, Map.Entry<String, String>... headers) -
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)
-