I want to know the file length, so I tried getContentLength(). It works fine with network connectivity (edge / 3g), but returns -1 with WiFi?What for? Wi-fi is good and the file was found, it can be downloaded, but the return is getContentLength()always "-1". I do not understand. file- google docs file.Is there any other way to get the length?
getContentLength()
file
My code is:
URL url = new URL(file); URLConnection conexion = url.openConnection(); conexion.connect(); int poids = conexion.getContentLength();
, . , ( ). "" , - , .
... , .
, HTTP-.
getContentLength() "" , . HTTP, , , , -1.
Transfer-Encoding; chunked- chunked. HTTP- Content-Length, ; Content-Length , Content-Length.
Transfer-Encoding
Content-Length
, - , . , . - , . HTTP-, .
Source: https://habr.com/ru/post/1758276/More articles:How to write a simple Python push server implementation using django? - pythonQuestion about checking null values - c #Instance instance and function call in a base class in C ++ - c ++How to return one element from string_to_array () in PostgreSQL 8.4? - arraysEfficient cancellation of the implementation of events for streams with alternating numbers? - multithreadingGeneral Category Prefix - javaSQL Select From Master - detailed tables - sqlPHP ASP equivalent print_r - variablesEclipse: Debug script that expects command line options - pythonError displaying OpenGL texture - c ++All Articles