java.lang.Object
it.auties.whatsapp.util.Medias
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static HttpClientprivate static final intprivate static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]calculateMac(byte[] encryptedMedia, MediaKeys keys) static StringcreateMediaUrl(String directPath) 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 Optional<byte[]> getDocumentThumbnail(byte[] file) static intgetDuration(byte[] file) getExtension(String name) static Optional<byte[]> getImageThumbnail(byte[] file, boolean jpg) getMimeType(byte[] media) getMimeType(String name) getMimeType(Path path) private static HttpClientstatic OptionalIntgetPagesCount(byte[] file) static byte[]getProfilePic(byte[] file) 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
-
WAVEFORM_SAMPLES
private static final int WAVEFORM_SAMPLES- See Also:
-
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:
-
httpClient
-
-
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) -
getOrCreateClient
-
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
-
getDocumentThumbnail
-
getImageThumbnail
-
getVideoThumbnail
-
getAudioWaveForm
-
toFloatArray
private static float[] toFloatArray(byte[] audioData)
-