ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øÃ£±â
½Ç½Ã°£ TV
ȨÀ¸·Î
À¥¿¡¼­ ÆÄÀÏ »çÀÌÁî¿Í ÄÜÅÙÆ®(ÄÁÅÙÃ÷) ŸÀÔ ¾Ë¾Æº¸´Â »ùÇÃÄÚµå
6³â Àü
À¥¿¡¼­ ÆÄÀÏ »çÀÌÁî¿Í ÄÜÅÙÆ®(ÄÁÅÙÃ÷) ŸÀÔ ¾Ë¾Æº¸´Â »ùÇÃÄÚµå
Sample Code for checking file size and content type.


private long fileSize = 0;
private String contentType = "";
private void checkFileSizeAndType(final String openUrl){
    
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {
            URL mUrl;
            try {
                mUrl = new URL(openUrl);
                final URLConnection connection = mUrl.openConnection();
                connection.setConnectTimeout(8000);
                connection.setReadTimeout(8000);
                connection.connect();
                String content_length = connection.getHeaderField("Content-Length");
                contentType = connection.getHeaderField("Content-Type");
                if(content_length == null){
                    fileSize = -1;
                }else{
                    fileSize = Long.parseLong(content_length);
                }
            } catch (SSLException e) {
                fileSize = -2;
            } catch (NullPointerException e) {
                fileSize = -1;
                e.printStackTrace();
            } catch (MalformedURLException e) {
                fileSize = -1;
                e.printStackTrace();
            } catch (IOException e) {
                fileSize = -1;
                e.printStackTrace();
            }

            if(fileSize == -2){
                TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() {
                            public X509Certificate[] getAcceptedIssuers() {return null;}
                            public void checkClientTrusted(X509Certificate[] certs, String authType) {}
                            public void checkServerTrusted(X509Certificate[] certs, String authType) {}
                        }
                };
                try {
                    SSLContext sc = SSLContext.getInstance("SSL");
                    sc.init(null, trustAllCerts, new SecureRandom());
                    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
                } catch (Exception e) {
                }
                try {
                    mUrl = new URL(openUrl);
                    final URLConnection connection = mUrl.openConnection();
                    connection.setConnectTimeout(8000);
                    connection.setReadTimeout(8000);
                    connection.connect();
                    String content_length = connection.getHeaderField("Content-Length");
                    if(content_length == null){
                        fileSize = -1;
                    }else{
                        fileSize = Long.parseLong(content_length);
                    }
                } catch (NullPointerException e) {
                    fileSize = -1;
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    fileSize = -1;
                    e.printStackTrace();
                } catch (IOException e) {
                    fileSize = -1;
                    e.printStackTrace();
                }
            }//SSL
            
            APLog.d(TAG, CLASS, "fileSize " + fileSize + " /contentType " + contentType);
            getMainHandler().post(new APRunnable() {
                @Override
                protected void runs() {
                    if(fileSize > 0 && isVideoContentType(contentType)) {
                        afterFileSizeAndType(true);
                    }
                    else {
                        afterFileSizeAndType(false);
                    }
                }
            });
        }
    });
    thread.setDaemon(true);
    thread.start();
}

private boolean isVideoContentType(String type) {
    if(type.contains("/")) {
        
        if(type.equalsIgnoreCase("application/x-mpegURL")
            || type.equalsIgnoreCase("application/vnd.apple.mpegurl")) return true;
        String[] t = type.split("/");
        if(t.length > 1) {
            if(t[0].equalsIgnoreCase("video")) {
                return true;
            }
        }
    }
    return false;
}

ÃßõÃßõ : 199 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,341
 Chrome NET::ERR CERT REVOKED ÇØ°á¹æ¹ý
1,340
 cmd ¸í·É¾î (¸í·É ÇÁ·ÒÇÁÆ® ¸í·É¾î) ¸ðÀ½
1,339
 Windows10 ƯÁ¤ ÇÁ·Î±×·¥(OCS 2007 R2)¿¡¼­ ÷ºÎÆÄÀÏ µå·¡±×¾Øµå·ÓÀÌ ¾È µÇ´Â Çö»ó
1,338
 À©µµ¿ì ·Î±×, °ü¸® À̺¥Æ® »èÁ¦
1,337
 Å¬¸° ºÎÆÃ
1,336
 Windows ±¸¼º ¿ä¼Ò ÀúÀå¼Ò¿¡¼­ ÆÄÀÏ ¼Õ»ó °Ë»ç
1,335
 Windows Defender °Ë»ç ±â·Ï »èÁ¦Çϱâ
1,334
 °£´ÜÇÑ À©µµ¿ì 10 Á¤Ç° ÀÎÁõ (Å©·¢ÇÁ·Î±×·¥ ÇÊ¿ä¾øÀ½)
1,333
 ¿À·ù³­ Æú´õ °­Á¦»èÁ¦ ¹æ¹ý
1,332
 Å©·Ò¿¡¼­ Ç÷¡½Ã Ç×»ó Çã¿ëÇϵµ·Ï ¼³Á¤Çϱâ (·¹Áö½ºÆ®¸®) reg ÆÄÀÏ ¸¸µé±â
1,331
 GPT µð½ºÅ©¸¦ MBR µð½ºÅ©·Î º¯È¯
1,330
 MBR µð½ºÅ©¸¦ GPT µð½ºÅ©·Î º¯È¯
1,329
 ±¸±Û °Ë»öÀ» 200% Ȱ¿ëÇÏ°Ô ÇØÁÖ´Â °Ë»ö ¸í·É¾î ÃÑÁ¤¸®
1,328
 [Jquery] jQuery·Î ¿ìŬ¸¯ ¹æÁö, µå·¡±× ¹æÁö, ¼±Åà ¹æÁö (IE10, ÆÄÀÌ¾îÆø½º, Å©·Ò È®ÀÎ)
1,327
 php »ç¿ëÀÚ Á¢¼ÓIP, ºê¶ó¿ìÀúÁ¤º¸, osÁ¤º¸, http, https Á¢¼ÓÇÁ·ÎÅäÄÝ ¾Ë¾Æ¿À±â
1,326
 [PHP] IE ºê¶ó¿ìÀú Á¢¼Ó °ËÃâÇϱâ
1,325
 À©µµ¿ì10 ½Ã½ºÅÛ ¿¹¾à ÆÄƼ¼Ç È®ÀÎ ¹× »èÁ¦
1,324
 À©µµ¿ì10 º¹±¸ ÆÄƼ¼Ç »èÁ¦ ¹æ¹ý
1,323
 À©µµ¿ì10 ºÎÆÃÁö¿¬ °ËÀºÈ­¸é¿¡¼­ ¸îºÐ°£ ¸Ó¹«´Â Çö»ó ÇØ°á¹æ¹ý
1,322
 »ï¼º³ëÆ®ºÏ ¹ÙÀÌ¿À½º ÁøÀÔÀÌ ºÒ°¡´ÉÇÑ °æ¿ì ¹ÙÀÌ¿À½º À缳ġ¿Í NVRAM ÃʱâÈ­
1,321
 ÀͽºÇ÷η¯(IE)ÀÇ ±¸±Û °Ë»ö°ø±ÞÀÚ Çѱ۷Πº¯°æ ¹æ¹ý
1,320
 À©µµ¿ì 10 ±âº» ¾Û »èÁ¦ ¹× º¹±¸
1,319
 meta ÅÂ±× http-equiv ¼³Á¤¹æ¹ý°ú Â÷ÀÌÁ¡
1,318
 ±¸±Û(Google)°Ë»ö¿¡¼­ °í±Þ¿¬»êÀÚ¸¦ ÀÌ¿ëÇÏ¿© ¸¹Àº Á¤º¸¸¦ ¾ò´Â ¹æ¹ý
1,317
 ÇÁ·Î±×·¥ ¾øÀÌ Çϵåµð½ºÅ© º¹»ç ¹× ¹é¾÷Çϱâ
1,316
 Windows7 ¾÷µ¥ÀÌÆ® ±â·Ï »èÁ¦¹æ¹ý
1,315
 Æ÷Åä¼¥ psd ÆÄÀÏ ¿¬°á ·¹Áö½ºÆ®¸®(registry) ÆíÁý
1,314
 À©µµ 10 Ãֽо÷µ¥ÀÌÆ® ÈÄ ÀÎÅÍ³Ý ¼ÓµµÀÇ ÀúÇϰ¡ ¹ß»ýÇÒ ¶§ Á¶Ä¡ »çÇ×
1,313
 Autotuning level ÇØÁ¦ (À©µµ¿ìºñ½ºÅ¸ ÀÌ»ó À©µµ¿ì)ÀÎÅÍ³Ý ¼Óµµ ºü¸£°Ô ÇÏ´Â ¹æ¹ý
1,312
 À©µµ¿ì¿¡¼­ ƯÁ¤ÇÁ·Î¼¼½º¸¦ Àϰý Á¾·áÇϴ¹ý
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æÄ§
Copyright (C) musictrot All rights reserved.