idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
23,300 | private void storeArgs ( Constructor constructor , Array conArgs ) { Class [ ] pmt = constructor . getParameterTypes ( ) ; Object o = conArgs . get ( pmt . length + 1 , null ) ; Constructor [ ] args ; if ( o == null ) { args = new Constructor [ 1 ] ; conArgs . setEL ( pmt . length + 1 , args ) ; } else { Constructor [ ... | seperate and store the different arguments of one constructor |
23,301 | public void release ( ) { super . release ( ) ; type = SearchCollection . SEARCH_TYPE_SIMPLE ; maxrows = - 1 ; criteria = "" ; startrow = 1 ; collections = null ; category = EMPTY ; categoryTree = "" ; status = null ; suggestions = SUGGESTIONS_NEVER ; contextPassages = 0 ; contextBytes = 300 ; contextHighlightBegin = "... | private String result = null ; |
23,302 | public void setType ( String type ) throws ApplicationException { if ( type == null ) return ; type = type . toLowerCase ( ) . trim ( ) ; if ( type . equals ( "simple" ) ) this . type = SearchCollection . SEARCH_TYPE_SIMPLE ; else if ( type . equals ( "explicit" ) ) this . type = SearchCollection . SEARCH_TYPE_EXPLICIT... | set the value type Specifies the criteria type for the search . |
23,303 | public void setCollection ( String collection ) throws PageException { String [ ] collNames = ListUtil . toStringArrayTrim ( ListUtil . listToArrayRemoveEmpty ( collection , ',' ) ) ; collections = new SearchCollection [ collNames . length ] ; SearchEngine se = pageContext . getConfig ( ) . getSearchEngine ( pageContex... | set the value collection The logical collection name that is the target of the search operation or an external collection with fully qualified path . |
23,304 | protected static Object reDefineType ( QueryColumnImpl column , Object value ) { column . typeChecked = false ; if ( value == null || column . type == Types . OTHER ) return value ; if ( value instanceof String && ( ( String ) value ) . isEmpty ( ) ) return value ; switch ( column . type ) { case Types . DOUBLE : retur... | redefine type of value |
23,305 | protected static void reOrganizeType ( QueryColumnImpl column ) { if ( ( column . type == Types . OTHER ) && ! column . typeChecked ) { column . typeChecked = true ; if ( column . size ( ) > 0 ) { checkOther ( column , column . data [ 0 ] ) ; for ( int i = 1 ; i < column . size ( ) ; i ++ ) { switch ( column . type ) {... | reorganize type of a column |
23,306 | public static String wrap ( String str , int wrapTextLength ) { if ( wrapTextLength <= 0 ) return str ; StringBuilder rtn = new StringBuilder ( ) ; String ls = SystemUtil . getOSSpecificLineSeparator ( ) ; Array arr = ListUtil . listToArray ( str , ls ) ; int len = arr . size ( ) ; for ( int i = 1 ; i <= len ; i ++ ) {... | wraps a String to specified length |
23,307 | public TagLib execute ( Config config , Tag tag , TagLibTag libTag , FunctionLib [ ] flibs , Data data ) throws TemplateException { return null ; } | Die Methode execute wird aufgerufen wenn der Context eines Tags geprueft werden soll . Diese Methode ueberschreibt jene des Interface Evaluator . Falls diese Methode durch eine Implementation nicht ueberschrieben wird ruft sie wiederere allenfalls implementierte evaluate Methoden auf . Mit Hilfe dieses Konstrukt ist es... |
23,308 | public void evaluate ( Tag tag , TagLibTag libTag , FunctionLib [ ] flibs ) throws EvaluatorException { evaluate ( tag ) ; evaluate ( tag , libTag ) ; } | Die Methode evaluate wird aufgerufen wenn der Context eines Tags geprueft werden soll . Diese Methode ueberschreibt jene des Interface Evaluator . Falls diese Methode durch eine Implementation nicht ueberschrieben wird ruft sie wiederere allenfalls implementierte evaluate Methoden auf . Mit Hilfe dieses Konstrukt ist e... |
23,309 | public Element getElement ( NodeList list , String key , String value ) { int len = list . getLength ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Node n = list . item ( i ) ; if ( n instanceof Element ) { Element el = ( Element ) n ; if ( el . getAttribute ( key ) . equalsIgnoreCase ( value ) ) return el ; } } return nul... | return XML Element matching name |
23,310 | public DateTime toDateTime ( Config config , Element el , String attributeName ) { String str = el . getAttribute ( attributeName ) ; if ( str == null ) return null ; return DateCaster . toDateAdvanced ( str , ThreadLocalPageContext . getTimeZone ( config ) , null ) ; } | reads a XML Element Attribute ans cast it to a DateTime Object |
23,311 | public DateTime toDateTime ( Element el , String attributeName , DateTime defaultValue ) { String value = el . getAttribute ( attributeName ) ; if ( value == null ) return defaultValue ; DateTime dtValue = Caster . toDate ( value , false , null , null ) ; if ( dtValue == null ) return defaultValue ; return dtValue ; } | reads a XML Element Attribute ans cast it to a DateTime |
23,312 | public Date toDate ( Config config , Element el , String attributeName ) { DateTime dt = toDateTime ( config , el , attributeName ) ; if ( dt == null ) return null ; return new DateImpl ( dt ) ; } | reads a XML Element Attribute ans cast it to a Date Object |
23,313 | public Time toTime ( Config config , Element el , String attributeName ) { DateTime dt = toDateTime ( config , el , attributeName ) ; if ( dt == null ) return null ; return new TimeImpl ( dt ) ; } | reads a XML Element Attribute ans cast it to a Time Object |
23,314 | public Credentials toCredentials ( Element el , String attributeUser , String attributePassword , Credentials defaultCredentials ) { String user = el . getAttribute ( attributeUser ) ; String pass = el . getAttribute ( attributePassword ) ; if ( user == null ) return defaultCredentials ; if ( pass == null ) pass = "" ;... | reads 2 XML Element Attribute ans cast it to a Credential |
23,315 | public void setString ( Element el , String key , String value ) { if ( value != null ) el . setAttribute ( key , value ) ; } | sets a string value to a XML Element |
23,316 | public void setBoolean ( Element el , String key , boolean value ) { el . setAttribute ( key , String . valueOf ( value ) ) ; } | sets a boolean value to a XML Element |
23,317 | public void setInt ( Element el , String key , int value ) { el . setAttribute ( key , String . valueOf ( value ) ) ; } | sets a int value to a XML Element |
23,318 | public void setDateTime ( Element el , String key , DateTime value ) { if ( value != null ) { String str = value . castToString ( null ) ; if ( str != null ) el . setAttribute ( key , str ) ; } } | sets a datetime value to a XML Element |
23,319 | public void setCredentials ( Element el , String username , String password , Credentials c ) { if ( c == null ) return ; if ( c . getUsername ( ) != null ) el . setAttribute ( username , c . getUsername ( ) ) ; if ( c . getPassword ( ) != null ) el . setAttribute ( password , c . getPassword ( ) ) ; } | sets a Credentials to a XML Element |
23,320 | public boolean removeSpace ( ) { int start = pos ; while ( pos < text . length && lcText [ pos ] == ' ' ) { pos ++ ; } return ( start < pos ) ; } | Stellt den Zeiger nach vorne wenn er sich innerhalb von Leerzeichen befindet bis die Leerzeichen fertig sind . |
23,321 | public ParserString subCFMLString ( int start , int count ) { return new ParserString ( String . valueOf ( text , start , count ) ) ; } | Gibt eine Untermenge des CFMLString als CFMLString zurueck ausgehend von start mit einer maximalen Laenge count . |
23,322 | public static synchronized CFMLEngine getInstance ( CFMLEngineFactory factory , BundleCollection bc ) { if ( engine == null ) { if ( SystemUtil . getLoaderVersion ( ) < 6.0D ) { if ( SystemUtil . isWindows ( ) ) throw new RuntimeException ( "You need to update a newer lucee.jar to run this version, you can download the... | get singelton instance of the CFML Engine |
23,323 | public void setScope ( String strScope ) throws ApplicationException { strScope = strScope . trim ( ) . toLowerCase ( ) ; if ( strScope . equals ( "onelevel" ) ) scope = SearchControls . ONELEVEL_SCOPE ; else if ( strScope . equals ( "base" ) ) scope = SearchControls . OBJECT_SCOPE ; else if ( strScope . equals ( "subt... | Specifies the scope of the search from the entry specified in the Start attribute for action = Query . |
23,324 | public void setModifytype ( String modifyType ) throws ApplicationException { modifyType = modifyType . trim ( ) . toLowerCase ( ) ; if ( modifyType . equals ( "add" ) ) this . modifyType = DirContext . ADD_ATTRIBUTE ; else if ( modifyType . equals ( "delete" ) ) this . modifyType = DirContext . REMOVE_ATTRIBUTE ; else... | Indicates whether to add delete or replace an attribute in a multi - value list of attributes . |
23,325 | public void setSortcontrol ( String sortControl ) throws PageException { String [ ] sortControlArr = ArrayUtil . trim ( ListUtil . toStringArray ( ListUtil . listToArrayRemoveEmpty ( sortControl , ',' ) ) ) ; for ( int i = 0 ; i < sortControlArr . length ; i ++ ) { String scs = sortControlArr [ i ] . trim ( ) . toLower... | Specifies how to sort query results . |
23,326 | public String [ ] getChildNames ( ) { if ( children == null || children . size ( ) == 0 ) return EMPTY_NAMES ; String [ ] arr = new String [ children . size ( ) ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = ( ( RamResourceCore ) children . get ( i ) ) . getName ( ) ; } return arr ; } | Gibt den Feldnamen children zurueck . |
23,327 | public RamResourceCore getChild ( String name , boolean caseSensitive ) { if ( children == null ) return null ; RamResourceCore child ; for ( int i = children . size ( ) - 1 ; i >= 0 ; i -- ) { child = ( RamResourceCore ) children . get ( i ) ; if ( child != null && ( caseSensitive ? child . getName ( ) . equals ( name... | returns a child that match given name |
23,328 | public void removeChild ( RamResourceCore core ) { if ( children == null ) return ; RamResourceCore child ; for ( int i = children . size ( ) - 1 ; i >= 0 ; i -- ) { child = ( RamResourceCore ) children . get ( i ) ; if ( child == core ) { children . remove ( i ) ; break ; } } } | remove given child from this core |
23,329 | public static Object getVariable ( PageContext pc , Collection collection , String var ) throws PageException { StringList list = parse ( pc , new ParserString ( var ) , false ) ; if ( list == null ) throw new InterpreterException ( "invalid variable declaration [" + var + "]" ) ; while ( list . hasNextNext ( ) ) { col... | reads a subelement from a struct |
23,330 | public static Object getVariableEL ( PageContext pc , String var , Object defaultValue ) { StringList list = parse ( pc , new ParserString ( var ) , false ) ; if ( list == null ) return defaultValue ; int scope = scopeString2Int ( pc . ignoreScopes ( ) , list . next ( ) ) ; Object coll = null ; if ( scope == Scope . SC... | get a variable from page context |
23,331 | public static Object setVariable ( PageContext pc , String var , Object value ) throws PageException { StringList list = parse ( pc , new ParserString ( var ) , false ) ; if ( list == null ) throw new InterpreterException ( "invalid variable name declaration [" + var + "]" ) ; if ( list . size ( ) == 1 ) { return pc . ... | sets a variable to page Context |
23,332 | public static Object removeVariable ( PageContext pc , String var ) throws PageException { StringList list = parse ( pc , new ParserString ( var ) , false ) ; if ( list == null ) throw new InterpreterException ( "invalid variable declaration [" + var + "]" ) ; if ( list . size ( ) == 1 ) { return pc . undefinedScope ( ... | removes a variable eith matching name from page context |
23,333 | private static StringList parse ( PageContext pc , ParserString ps , boolean doLowerCase ) { String id = readIdentifier ( ps , doLowerCase ) ; if ( id == null ) return null ; StringList list = new StringList ( id ) ; CFMLExpressionInterpreter interpreter = null ; while ( true ) { if ( ps . forwardIfCurrent ( '.' ) ) { ... | parse a Literal variable String and return result as String List |
23,334 | public static int scopeString2Int ( boolean ignoreScope , String type ) { type = StringUtil . toLowerCase ( type ) ; char c = type . charAt ( 0 ) ; if ( ignoreScope ) { if ( 'a' == c ) { if ( "arguments" . equals ( type ) ) return Scope . SCOPE_ARGUMENTS ; } else if ( 'l' == c ) { if ( "local" . equals ( type ) ) retur... | translate a string type definition to its int representation |
23,335 | public PageSource getPageSource ( String key , boolean updateAccesTime ) { PageSource ps = pageSources . get ( key . toLowerCase ( ) ) ; if ( ps == null ) return null ; if ( updateAccesTime ) ps . setLastAccessTime ( ) ; return ps ; } | return pages matching to key |
23,336 | public void setPage ( String key , PageSource ps ) { ps . setLastAccessTime ( ) ; pageSources . put ( key . toLowerCase ( ) , ps ) ; } | sts a page object to the page pool |
23,337 | public boolean remove ( String key ) { if ( pageSources . remove ( key . toLowerCase ( ) ) != null ) return true ; Set < String > set = pageSources . keySet ( ) ; String [ ] keys = set . toArray ( new String [ set . size ( ) ] ) ; PageSource ps ; for ( String k : keys ) { ps = pageSources . get ( k ) ; if ( key . equal... | removes a page from the page pool |
23,338 | public void clearUnused ( ConfigImpl config ) { SystemOut . printDate ( config . getOutWriter ( ) , "PagePool: " + size ( ) + ">(" + maxSize + ")" ) ; if ( size ( ) > maxSize ) { String [ ] keys = keys ( ) ; LongKeyList list = new LongKeyList ( ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { PageSource ps = getPageS... | clear unused pages from page pool |
23,339 | public void clearPages ( ClassLoader cl ) { Iterator < PageSource > it = this . pageSources . values ( ) . iterator ( ) ; PageSourceImpl entry ; while ( it . hasNext ( ) ) { entry = ( PageSourceImpl ) it . next ( ) ; if ( cl != null ) entry . clear ( cl ) ; else entry . clear ( ) ; } } | remove all Page from Pool using this classloader |
23,340 | public static void writeOut ( BufferedImage image , OutputStream os , String format ) throws IOException { ImageIO . write ( image , format , os ) ; } | write out image object to a output stream |
23,341 | public static String randomString ( int length ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < length ; i ++ ) { sb . append ( chars [ AbstractCaptcha . rnd ( 0 , chars . length - 1 ) ] ) ; } return sb . toString ( ) ; } | creates a random String in given length |
23,342 | private Pair [ ] translateQS ( String qs ) { if ( qs == null ) return new Pair [ 0 ] ; Array arr = lucee . runtime . type . util . ListUtil . listToArrayRemoveEmpty ( qs , "&" ) ; Pair [ ] parameters = new Pair [ arr . size ( ) ] ; int index ; String name ; for ( int i = 1 ; i <= parameters . length ; i ++ ) { name = C... | constructor of the class |
23,343 | public void setHeader ( String name , String value ) { headers = ReqRspUtil . set ( headers , name , value ) ; } | sets a new header value |
23,344 | public void addHeader ( String name , String value ) { headers = ReqRspUtil . add ( headers , name , value ) ; } | add a new header value |
23,345 | public static Object call ( PageContext pc , Object udf , double timeout ) throws PageException { return Future . _then ( pc , Caster . toFunction ( udf ) , ( long ) timeout ) ; } | Verify if in thread or not |
23,346 | private static void loadAgent ( Config config , Log log , String agentJar , Class < ? > vmClass ) { try { RuntimeMXBean runtime = ManagementFactory . getRuntimeMXBean ( ) ; String pid = runtime . getName ( ) ; if ( pid . indexOf ( "@" ) != - 1 ) pid = pid . substring ( 0 , pid . indexOf ( "@" ) ) ; log . info ( "Instru... | Attach and load an agent class . |
23,347 | public static lucee . runtime . config . DebugEntry getDebugEntry ( PageContext pc ) { String addr = pc . getHttpServletRequest ( ) . getRemoteAddr ( ) ; lucee . runtime . config . DebugEntry debugEntry = ( ( ConfigImpl ) pc . getConfig ( ) ) . getDebugEntry ( addr , null ) ; return debugEntry ; } | returns the DebugEntry for the current request s IP address or null if no template matches the address |
23,348 | private static void buildRanges ( ) { ranges = new LCR [ ] { new LCR ( 4000000000000L , 4999999999999L , 13 , VISA , true ) , new LCR ( 30000000000000L , 30599999999999L , 14 , DINERS , true ) , new LCR ( 36000000000000L , 36999999999999L , 14 , DINERS , true ) , new LCR ( 38000000000000L , 38999999999999L , 14 , DINER... | build table of which ranges of credit card number belong to which vendor |
23,349 | protected static int findMatchingRange ( long creditCardNumber ) { if ( creditCardNumber < 1000000000000L ) { return NOT_ENOUGH_DIGITS ; } if ( creditCardNumber > 9999999999999999L ) { return TOO_MANY_DIGITS ; } if ( ranges [ cachedLastFind ] . low <= creditCardNumber && creditCardNumber <= ranges [ cachedLastFind ] . ... | Finds a matching range in the ranges array for a given creditCardNumber . |
23,350 | public static boolean isValid ( long creditCardNumber ) { int i = findMatchingRange ( creditCardNumber ) ; if ( i < 0 ) { return false ; } if ( ranges [ i ] . hasCheckDigit ) { long number = creditCardNumber ; int checksum = 0 ; for ( int place = 0 ; place < 16 ; place ++ ) { int digit = ( int ) ( number % 10 ) ; numbe... | Determine if the credit card number is valid i . e . has good prefix and checkdigit . Does _not_ ask the credit card company if this card has been issued or is in good standing . |
23,351 | public static int recognizeVendor ( long creditCardNumber ) { int i = findMatchingRange ( creditCardNumber ) ; if ( i < 0 ) { return i ; } return ranges [ i ] . vendor ; } | Determine the credit card company . Does NOT validate checkdigit . |
23,352 | public static String toCreditcard ( String strCreditCardNumber ) throws ExpressionException { long number = toLong ( strCreditCardNumber , - 1 ) ; if ( number == - 1 ) throw new ExpressionException ( "invalid creditcard number [" + strCreditCardNumber + "]" ) ; return toPrettyString ( number ) ; } | 1800 15 mod 10 |
23,353 | private static String toPrettyString ( long creditCardNumber ) { String plain = Long . toString ( creditCardNumber ) ; int length = plain . length ( ) ; switch ( length ) { case 12 : return plain . substring ( 0 , 3 ) + ' ' + plain . substring ( 3 , 6 ) + ' ' + plain . substring ( 6 , 9 ) + ' ' + plain . substring ( 9 ... | Convert a creditCardNumber as long to a formatted String . Currently it breaks 16 - digit numbers into groups of 4 . |
23,354 | public static void swap ( Array array , int left , int right ) throws ExpressionException { int len = array . size ( ) ; if ( len == 0 ) throw new ExpressionException ( "array is empty" ) ; if ( left < 1 || left > len ) throw new ExpressionException ( "invalid index [" + left + "]" , "valid indexes are from 1 to " + le... | swap to values of the array |
23,355 | public static int find ( Array array , Object object ) { int len = array . size ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { Object tmp = array . get ( i , null ) ; try { if ( tmp != null && Operator . compare ( object , tmp ) == 0 ) return i ; } catch ( PageException e ) { } } return 0 ; } | find a object in array |
23,356 | public static double avg ( Array array ) throws ExpressionException { if ( array . size ( ) == 0 ) return 0 ; return sum ( array ) / array . size ( ) ; } | average of all values of the array only work when all values are numeric |
23,357 | public static double sum ( Array array ) throws ExpressionException { if ( array . getDimension ( ) > 1 ) throw new ExpressionException ( "can only get sum/avg from 1 dimensional arrays" ) ; double rtn = 0 ; int len = array . size ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { rtn += _toDoubleValue ( array , i ) ; } retur... | sum of all values of a array only work when all values are numeric |
23,358 | public static double median ( Array array ) throws ExpressionException { int len = array . size ( ) ; if ( len == 0 ) return 0 ; if ( array . getDimension ( ) > 1 ) throw new ExpressionException ( "Median() can only be calculated for one dimensional arrays" ) ; double [ ] arr = new double [ len ] ; for ( int i = 0 ; i ... | median value of all items in the arrays only works when all values are numeric |
23,359 | public static double min ( Array array ) throws PageException { if ( array . getDimension ( ) > 1 ) throw new ExpressionException ( "can only get max value from 1 dimensional arrays" ) ; if ( array . size ( ) == 0 ) return 0 ; double rtn = _toDoubleValue ( array , 1 ) ; int len = array . size ( ) ; try { for ( int i = ... | the smallest value of all values inside the array only work when all values are numeric |
23,360 | public static Object setEL ( Object o , int index , Object value ) { try { return set ( o , index , value ) ; } catch ( ArrayUtilException e ) { return null ; } } | sets a value to a array at defined index |
23,361 | public static Object [ ] toArray ( List < ? > list ) { Iterator < ? > it = list . iterator ( ) ; Class clazz = null ; while ( it . hasNext ( ) ) { Object v = it . next ( ) ; if ( v == null ) continue ; if ( clazz == null ) clazz = v . getClass ( ) ; else if ( clazz != v . getClass ( ) ) return list . toArray ( ) ; } if... | creates a native array out of the input list if all values are from the same type this type is used for the array otherwise object |
23,362 | public static Object [ ] resizeIfNeeded ( Object [ ] arr , int minSize , boolean doPowerOf2 ) { if ( arr . length >= minSize ) return arr ; if ( doPowerOf2 ) minSize = MathUtil . nextPowerOf2 ( minSize ) ; Object [ ] result = new Object [ minSize ] ; System . arraycopy ( arr , 0 , result , 0 , arr . length ) ; return r... | this method returns the original array if its length is equal or greater than the minSize or create a new array and copies the data from the original array into the new one . |
23,363 | public void setLog ( String log ) throws ApplicationException { if ( StringUtil . isEmpty ( log , true ) ) return ; this . log = log . trim ( ) ; } | set the value log If you omit the file attribute specifies the standard log file in which to write the message . Ignored if you specify a file attribute |
23,364 | public void setType ( String type ) throws ApplicationException { type = type . toLowerCase ( ) . trim ( ) ; if ( type . equals ( "information" ) ) this . type = lucee . commons . io . log . Log . LEVEL_INFO ; else if ( type . equals ( "info" ) ) this . type = lucee . commons . io . log . Log . LEVEL_INFO ; else if ( t... | set the value type The type or severity of the message . |
23,365 | public void setFile ( String file ) throws ApplicationException { if ( StringUtil . isEmpty ( file ) ) return ; if ( file . indexOf ( '/' ) != - 1 || file . indexOf ( '\\' ) != - 1 ) throw new ApplicationException ( "value [" + file + "] from attribute [file] at tag [log] can only contain a filename, file separators li... | set the value file |
23,366 | private static List copyValues ( FDStackFrameImpl frame , List to , Struct from ) { Iterator it = from . entrySet ( ) . iterator ( ) ; Entry entry ; while ( it . hasNext ( ) ) { entry = ( Entry ) it . next ( ) ; to . add ( new FDVariable ( frame , ( String ) entry . getKey ( ) , FDCaster . toFDValue ( frame , entry . g... | copy all data from given struct to given list and translate it to a FDValue |
23,367 | public static boolean isNewerThan ( final Version left , final Version right ) { if ( left . getMajor ( ) > right . getMajor ( ) ) return true ; if ( left . getMajor ( ) < right . getMajor ( ) ) return false ; if ( left . getMinor ( ) > right . getMinor ( ) ) return true ; if ( left . getMinor ( ) < right . getMinor ( ... | check left value against right value |
23,368 | public static byte [ ] encrypt ( byte [ ] input , String key , String algorithm , byte [ ] ivOrSalt , int iterations ) throws PageException { return crypt ( input , key , algorithm , ivOrSalt , iterations , false ) ; } | an encrypt method that takes a byte - array for input and returns an encrypted byte - array |
23,369 | public static String encrypt ( String input , String key , String algorithm , byte [ ] ivOrSalt , int iterations , String encoding , String charset ) throws PageException { try { if ( charset == null ) charset = DEFAULT_CHARSET ; if ( encoding == null ) encoding = DEFAULT_ENCODING ; byte [ ] baInput = input . getBytes ... | an encrypt method that takes a clear - text String for input and returns an encrypted encoded String |
23,370 | public static byte [ ] decrypt ( byte [ ] input , String key , String algorithm , byte [ ] ivOrSalt , int iterations ) throws PageException { return crypt ( input , key , algorithm , ivOrSalt , iterations , true ) ; } | a decrypt method that takes an encrypted byte - array for input and returns an unencrypted byte - array |
23,371 | public static String decrypt ( String input , String key , String algorithm , byte [ ] ivOrSalt , int iterations , String encoding , String charset ) throws PageException { try { if ( charset == null ) charset = DEFAULT_CHARSET ; if ( encoding == null ) encoding = DEFAULT_ENCODING ; byte [ ] baInput = Coder . decode ( ... | a decrypt method that takes an encrypted encoded String for input and returns a clear - text String |
23,372 | void release ( DatasourceConnection dc ) { if ( dc != null ) { try { dc . getConnection ( ) . commit ( ) ; dc . getConnection ( ) . setAutoCommit ( true ) ; dc . getConnection ( ) . setTransactionIsolation ( Connection . TRANSACTION_NONE ) ; } catch ( SQLException e ) { } getManager ( ) . releaseConnection ( ThreadLoca... | release datasource connection |
23,373 | public static int matchPath ( Struct variables , Path [ ] restPath , String [ ] callerPath ) { if ( restPath . length > callerPath . length ) return - 1 ; int index = 0 ; for ( ; index < restPath . length ; index ++ ) { if ( ! restPath [ index ] . match ( variables , callerPath [ index ] ) ) return - 1 ; } return index... | check if caller path match the cfc path |
23,374 | public String sendMessage ( String gatewayId , Struct data ) throws PageException , IOException { Gateway g = getGateway ( gatewayId ) ; if ( g . getState ( ) != Gateway . RUNNING ) throw new GatewayException ( "Gateway [" + gatewayId + "] is not running" ) ; return g . sendMessage ( data ) ; } | send the message to the gateway |
23,375 | public void stopAll ( ) { Iterator < GatewayEntry > it = getEntries ( ) . values ( ) . iterator ( ) ; Gateway g ; while ( it . hasNext ( ) ) { g = it . next ( ) . getGateway ( ) ; if ( g != null ) stop ( g ) ; } } | stop all entries |
23,376 | private static void compressGZip ( Resource source , Resource target ) throws IOException { if ( source . isDirectory ( ) ) { throw new IOException ( "you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files" ) ; } InputStream is = null ; OutputStream os = null ; try { i... | compress a source file to a gzip file |
23,377 | private static void _compressBZip2 ( InputStream source , OutputStream target ) throws IOException { InputStream is = IOUtil . toBufferedInputStream ( source ) ; OutputStream os = new BZip2CompressorOutputStream ( IOUtil . toBufferedOutputStream ( target ) ) ; IOUtil . copy ( is , os , true , true ) ; } | compress a source file to a bzip2 file |
23,378 | public Field [ ] getFields ( Class clazz , String fieldname ) { Struct fieldMap ; Object o ; synchronized ( map ) { o = map . get ( clazz ) ; if ( o == null ) { fieldMap = store ( clazz ) ; } else fieldMap = ( Struct ) o ; } o = fieldMap . get ( fieldname , null ) ; if ( o == null ) return null ; return ( Field [ ] ) o... | returns all fields matching given criteria or null if field does exist |
23,379 | public MappingImpl cloneReadOnly ( ConfigImpl config ) { return new MappingImpl ( config , virtual , strPhysical , strArchive , inspect , physicalFirst , hidden , true , topLevel , appMapping , ignoreVirtual , appListener , listenerMode , listenerType ) ; } | clones a mapping and make it readOnly |
23,380 | public static String serialize ( Object object ) { if ( object == null ) return "[null]" ; try { return new ScriptConverter ( ) . serialize ( object ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; return object . toString ( ) ; } } | translate a object to its string representation |
23,381 | public static Object callWithNamedValues ( PageContext pc , Object coll , Collection . Key methodName , Struct args , short type , String strType ) throws PageException { Map < Key , FunctionLibFunction > members = getMembers ( pc , type ) ; FunctionLibFunction member = members . get ( methodName ) ; if ( member != nul... | used in extension image |
23,382 | public static TimeZone toTimeZone ( String strTimezone , TimeZone defaultValue ) { if ( strTimezone == null ) return defaultValue ; String strTimezoneTrimmed = StringUtil . replace ( strTimezone . trim ( ) . toLowerCase ( ) , " " , "" , false ) ; TimeZone tz = getTimeZoneFromIDS ( strTimezoneTrimmed ) ; if ( tz != null... | translate timezone string format to a timezone |
23,383 | public String getValueAsString ( Expression expr ) throws PageException { expr . writeOut ( this , Expression . MODE_REF ) ; return Caster . toString ( stack . pop ( ) ) ; } | removes the element from top of the stack |
23,384 | public static String repeatString ( String str , int count ) { if ( count <= 0 ) return "" ; char [ ] chars = str . toCharArray ( ) ; char [ ] rtn = new char [ chars . length * count ] ; int pos = 0 ; for ( int i = 0 ; i < count ; i ++ ) { for ( int y = 0 ; y < chars . length ; y ++ ) rtn [ pos ++ ] = chars [ y ] ; } r... | reapeats a string |
23,385 | public static String reqExpEscape ( String str ) { char [ ] arr = str . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( str . length ( ) * 2 ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { sb . append ( '\\' ) ; sb . append ( arr [ i ] ) ; } return sb . toString ( ) ; } | escape all special characters of the regular expresson language |
23,386 | public static String toIdentityVariableName ( String varName ) { char [ ] chars = varName . toCharArray ( ) ; long changes = 0 ; StringBuilder rtn = new StringBuilder ( chars . length + 2 ) ; rtn . append ( "CF" ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { char c = chars [ i ] ; if ( ( c >= 'a' && c <= 'z' ) || ... | translate a string to a valid identity variable name |
23,387 | public static String toClassName ( String str ) { StringBuilder rtn = new StringBuilder ( ) ; String [ ] arr = str . split ( "[\\\\|//]" ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] . length ( ) == 0 ) continue ; if ( rtn . length ( ) != 0 ) rtn . append ( '.' ) ; char [ ] chars = arr [ i ] . toChar... | translate a string to a valid classname string |
23,388 | public static String ltrim ( String str , String defaultValue ) { if ( str == null ) return defaultValue ; int len = str . length ( ) ; int st = 0 ; while ( ( st < len ) && ( str . charAt ( st ) <= ' ' ) ) { st ++ ; } return ( ( st > 0 ) ) ? str . substring ( st ) : str ; } | This function returns a string with whitespace stripped from the beginning of str |
23,389 | public static String rtrim ( String str , String defaultValue ) { if ( str == null ) return defaultValue ; int len = str . length ( ) ; while ( ( 0 < len ) && ( str . charAt ( len - 1 ) <= ' ' ) ) { len -- ; } return ( len < str . length ( ) ) ? str . substring ( 0 , len ) : str ; } | This function returns a string with whitespace stripped from the end of str |
23,390 | public static String trim ( String str , String defaultValue ) { if ( str == null ) return defaultValue ; return str . trim ( ) ; } | trim given value return defaultvalue when input is null |
23,391 | public static String trim ( String str , boolean removeBOM , boolean removeSpecialWhiteSpace , String defaultValue ) { if ( str == null ) return defaultValue ; if ( str . isEmpty ( ) ) return str ; if ( removeBOM ) { if ( str . charAt ( 0 ) == '\uFEFF' ) str = str . substring ( 1 ) ; else if ( str . charAt ( 0 ) == '\u... | trim given value return defaultvalue when input is null this function no only removes the classic whitespaces it also removes Byte order masks forgotten to remove when reading a UTF file . |
23,392 | public static boolean hasLineFeed ( String str ) { int len = str . length ( ) ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = str . charAt ( i ) ; if ( c == '\n' || c == '\r' ) return true ; } return false ; } | return if in a string are line feeds or not |
23,393 | public static String suppressWhiteSpace ( String str ) { int len = str . length ( ) ; StringBuilder sb = new StringBuilder ( len ) ; char c ; char buffer = 0 ; for ( int i = 0 ; i < len ; i ++ ) { c = str . charAt ( i ) ; if ( c == '\n' || c == '\r' ) buffer = '\n' ; else if ( isWhiteSpace ( c ) ) { if ( buffer == 0 ) ... | remove all white spaces followed by whitespaces |
23,394 | public static String replace ( String input , String find , String repl , boolean firstOnly , boolean ignoreCase ) { int findLen = find . length ( ) ; if ( findLen == 0 ) return input ; if ( ! ignoreCase && findLen == repl . length ( ) ) { if ( find . equals ( repl ) ) return input ; if ( ! firstOnly && findLen == 1 ) ... | performs a replace operation on a string |
23,395 | public static boolean startsWith ( String str , char prefix ) { return str != null && str . length ( ) > 0 && str . charAt ( 0 ) == prefix ; } | Tests if this string starts with the specified prefix . |
23,396 | public static boolean endsWith ( String str , char suffix ) { return str != null && str . length ( ) > 0 && str . charAt ( str . length ( ) - 1 ) == suffix ; } | Tests if this string ends with the specified suffix . |
23,397 | public static boolean startsWithIgnoreCase ( final String base , final String start ) { if ( base . length ( ) < start . length ( ) ) { return false ; } return base . regionMatches ( true , 0 , start , 0 , start . length ( ) ) ; } | Helper functions to query a strings start portion . The comparison is case insensitive . |
23,398 | public static boolean endsWithIgnoreCase ( final String base , final String end ) { if ( base . length ( ) < end . length ( ) ) { return false ; } return base . regionMatches ( true , base . length ( ) - end . length ( ) , end , 0 , end . length ( ) ) ; } | Helper functions to query a strings end portion . The comparison is case insensitive . |
23,399 | public static String toLowerCase ( String str ) { int len = str . length ( ) ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = str . charAt ( i ) ; if ( ! ( ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) ) ) { return str . toLowerCase ( ) ; } } return str ; } | cast a string a lower case String is faster than the String . toLowerCase if all Character are already Low Case |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.