| 
					
				 | 
			
			
				@@ -102,24 +102,22 @@ public class VideoDownloader { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int responseCode = connection.getResponseCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_PARTIAL) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 long expectedSize = connection.getContentLengthLong(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                try (InputStream inputStream = connection.getInputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     OutputStream outputStream = Files.newOutputStream(file.toPath())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    byte[] buffer = new byte[1024 * 1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    int bytesRead; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    int downloadLength = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    while ((bytesRead = inputStream.read(buffer)) != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        downloadLength += bytesRead; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        outputStream.write(buffer, 0, bytesRead); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (expectedSize == downloadLength) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                InputStream inputStream = connection.getInputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                OutputStream outputStream = Files.newOutputStream(file.toPath()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                byte[] buffer = new byte[1024 * 1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int bytesRead; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("download start path={} expectedSize={}", path, expectedSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                long size = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while ((bytesRead = inputStream.read(buffer)) != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    size += bytesRead; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outputStream.write(buffer, 0, bytesRead); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.info("download size={}", size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (file.length() == expectedSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("download end path={}", path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (file.length() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return responseCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("download error", e); 
			 |