Java Code Examples for org.telegram.tgnet.TLRPC#TL_inputEncryptedFileLocation
The following examples show how to use
org.telegram.tgnet.TLRPC#TL_inputEncryptedFileLocation .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(TLRPC.FileLocation photoLocation, String extension, int size) { if (photoLocation instanceof TLRPC.TL_fileEncryptedLocation) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = photoLocation.volume_id; location.volume_id = photoLocation.volume_id; location.access_hash = photoLocation.secret; location.local_id = photoLocation.local_id; iv = new byte[32]; System.arraycopy(photoLocation.iv, 0, iv, 0, iv.length); key = photoLocation.key; initialDatacenterId = datacenterId = photoLocation.dc_id; } else if (photoLocation instanceof TLRPC.TL_fileLocation) { location = new TLRPC.TL_inputFileLocation(); location.volume_id = photoLocation.volume_id; location.secret = photoLocation.secret; location.local_id = photoLocation.local_id; initialDatacenterId = datacenterId = photoLocation.dc_id; allowDisordererFileSave = true; } currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 2
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(TLRPC.FileLocation photoLocation, String extension, int size) { if (photoLocation instanceof TLRPC.TL_fileEncryptedLocation) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = photoLocation.volume_id; location.volume_id = photoLocation.volume_id; location.access_hash = photoLocation.secret; location.local_id = photoLocation.local_id; iv = new byte[32]; System.arraycopy(photoLocation.iv, 0, iv, 0, iv.length); key = photoLocation.key; initialDatacenterId = datacenterId = photoLocation.dc_id; } else if (photoLocation instanceof TLRPC.TL_fileLocation) { location = new TLRPC.TL_inputFileLocation(); location.volume_id = photoLocation.volume_id; location.secret = photoLocation.secret; location.local_id = photoLocation.local_id; initialDatacenterId = datacenterId = photoLocation.dc_id; allowDisordererFileSave = true; } currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 3
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation) { try { if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; } totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if ("video/mp4".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { if (documentLocation.mime_type != null) { switch (documentLocation.mime_type) { case "video/mp4": ext = ".mp4"; break; case "audio/ogg": ext = ".ogg"; break; default: ext = ""; break; } } else { ext = ""; } } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }
Example 4
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation) { try { if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; } totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if ("video/mp4".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { if (documentLocation.mime_type != null) { switch (documentLocation.mime_type) { case "video/mp4": ext = ".mp4"; break; case "audio/ogg": ext = ".ogg"; break; default: ext = ""; break; } } else { ext = ""; } } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }
Example 5
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(ImageLocation imageLocation, Object parent, String extension, int size) { parentObject = parent; if (imageLocation.isEncrypted()) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; iv = new byte[32]; System.arraycopy(imageLocation.iv, 0, iv, 0, iv.length); key = imageLocation.key; } else if (imageLocation.photoPeer != null) { location = new TLRPC.TL_inputPeerPhotoFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.big = imageLocation.photoPeerBig; location.peer = imageLocation.photoPeer; } else if (imageLocation.stickerSet != null) { location = new TLRPC.TL_inputStickerSetThumb(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.stickerset = imageLocation.stickerSet; } else if (imageLocation.thumbSize != null) { if (imageLocation.photoId != 0) { location = new TLRPC.TL_inputPhotoFileLocation(); location.id = imageLocation.photoId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } else { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = imageLocation.documentId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } if (location.file_reference == null) { location.file_reference = new byte[0]; } } else { location = new TLRPC.TL_inputFileLocation(); location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.secret = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; if (location.file_reference == null) { location.file_reference = new byte[0]; } allowDisordererFileSave = true; } ungzip = imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE || imageLocation.imageType == FileLoader.IMAGE_TYPE_SVG; initialDatacenterId = datacenterId = imageLocation.dc_id; currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 6
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation, Object parent) { try { parentObject = parent; if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; location.file_reference = documentLocation.file_reference; location.thumb_size = ""; if (location.file_reference == null) { location.file_reference = new byte[0]; } initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; for (int a = 0, N = documentLocation.attributes.size(); a < N; a++) { if (documentLocation.attributes.get(a) instanceof TLRPC.TL_documentAttributeVideo) { supportsPreloading = true; break; } } } ungzip = "application/x-tgsticker".equals(documentLocation.mime_type) || "application/x-tgwallpattern".equals(documentLocation.mime_type); totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if (FileLoader.isVideoMimeType(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { ext = FileLoader.getExtensionByMimeType(documentLocation.mime_type); } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }
Example 7
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(ImageLocation imageLocation, Object parent, String extension, int size) { parentObject = parent; if (imageLocation.isEncrypted()) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; iv = new byte[32]; System.arraycopy(imageLocation.iv, 0, iv, 0, iv.length); key = imageLocation.key; } else if (imageLocation.photoPeer != null) { location = new TLRPC.TL_inputPeerPhotoFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.big = imageLocation.photoPeerBig; location.peer = imageLocation.photoPeer; } else if (imageLocation.stickerSet != null) { location = new TLRPC.TL_inputStickerSetThumb(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.stickerset = imageLocation.stickerSet; } else if (imageLocation.thumbSize != null) { if (imageLocation.photoId != 0) { location = new TLRPC.TL_inputPhotoFileLocation(); location.id = imageLocation.photoId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } else { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = imageLocation.documentId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } if (location.file_reference == null) { location.file_reference = new byte[0]; } } else { location = new TLRPC.TL_inputFileLocation(); location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.secret = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; if (location.file_reference == null) { location.file_reference = new byte[0]; } allowDisordererFileSave = true; } ungzip = imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE || imageLocation.imageType == FileLoader.IMAGE_TYPE_SVG; initialDatacenterId = datacenterId = imageLocation.dc_id; currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 8
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation, Object parent) { try { parentObject = parent; if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; location.file_reference = documentLocation.file_reference; location.thumb_size = ""; if (location.file_reference == null) { location.file_reference = new byte[0]; } initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; for (int a = 0, N = documentLocation.attributes.size(); a < N; a++) { if (documentLocation.attributes.get(a) instanceof TLRPC.TL_documentAttributeVideo) { supportsPreloading = true; break; } } } ungzip = "application/x-tgsticker".equals(documentLocation.mime_type) || "application/x-tgwallpattern".equals(documentLocation.mime_type); totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if (FileLoader.isVideoMimeType(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { ext = FileLoader.getExtensionByMimeType(documentLocation.mime_type); } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }