public Reader getUrl ( String prefix , String postfix ) throws MtasParserException { String url = getString ( ) ; if ( ( url != null ) && ! url . equals ( "" ) ) { if ( prefix != null ) { url = prefix + url ; } if ( postfix != null ) { url = url + postfix ; } if ( url . startsWith ( "http://" ) || url . startsWith ( "https://" ) ) { BufferedReader in = null ; try { URLConnection connection = new URL ( url ) . openConnection ( ) ; connection . setRequestProperty ( "Accept-Encoding" , "gzip" ) ; connection . setReadTimeout ( 10000 ) ; if ( connection . getHeaderField ( "Content-Encoding" ) != null && connection . getHeaderField ( "Content-Encoding" ) . equals ( "gzip" ) ) { in = new BufferedReader ( new InputStreamReader ( new GZIPInputStream ( connection . getInputStream ( ) ) , StandardCharsets . UTF_8 ) ) ; } else { in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ( ) , StandardCharsets . UTF_8 ) ) ; } return in ; } catch ( IOException ex ) { log . debug ( ex ) ; throw new MtasParserException ( "couldn't get " + url ) ; } } else { throw new MtasParserException ( "no valid url: " + url ) ; } } else { throw new MtasParserException ( "no valid url: " + url ) ; } }
Gets the url .