idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
23,400
public static char lastChar ( String str ) { if ( str == null || str . length ( ) == 0 ) return 0 ; return str . charAt ( str . length ( ) - 1 ) ; }
return the last character of a string if string ist empty return 0 ;
23,401
public static boolean isAllAlpha ( String str ) { if ( str == null ) return false ; for ( int i = str . length ( ) - 1 ; i >= 0 ; i -- ) { if ( ! Character . isLetter ( str . charAt ( i ) ) ) return false ; } return true ; }
returns true if all characters in the string are letters
23,402
public static boolean isAllUpperCase ( String str ) { if ( str == null ) return false ; boolean hasLetters = false ; char c ; for ( int i = str . length ( ) - 1 ; i >= 0 ; i -- ) { c = str . charAt ( i ) ; if ( Character . isLetter ( c ) ) { if ( ! Character . isUpperCase ( c ) ) return false ; hasLetters = true ; } } ...
returns true if the input string has letters and they are all UPPERCASE
23,403
public static String substring ( String str , int off , int len ) { return str . substring ( off , off + len ) ; }
this method works different from the regular substring method the regular substring method takes startIndex and endIndex as second and third argument this method takes offset and length
23,404
public void setNameconflict ( String nameconflict ) throws PageException { nameconflict = nameconflict . toLowerCase ( ) . trim ( ) ; if ( "error" . equals ( nameconflict ) ) this . nameconflict = NAMECONFLICT_ERROR ; else if ( "skip" . equals ( nameconflict ) ) this . nameconflict = NAMECONFLICT_SKIP ; else if ( "over...
set the value nameconflict Action to take if filename is the same as that of a file in the directory .
23,405
public Object touch ( int row ) throws PageException { Object o = query . getAt ( columnName , row , NullSupportHelper . NULL ( ) ) ; if ( o != NullSupportHelper . NULL ( ) ) return o ; return query . setAt ( columnName , row , new StructImpl ( ) ) ; }
touch a value means if key dosent exist it will created
23,406
public IPRangeNode findFast ( String addr ) { InetAddress iaddr ; try { iaddr = InetAddress . getByName ( addr ) ; } catch ( UnknownHostException ex ) { return null ; } return findFast ( iaddr ) ; }
performs a binary search over sorted list
23,407
public static ConstructorParameterPair getConstructorParameterPairIgnoreCase ( Class clazz , Object [ ] parameters ) throws NoSuchMethodException { if ( parameters == null ) parameters = new Object [ 0 ] ; Class [ ] parameterClasses = new Class [ parameters . length ] ; for ( int i = 0 ; i < parameters . length ; i ++ ...
search the matching constructor to defined parameter list also translate parameters for matching
23,408
public static Object callMethod ( Object object , String methodName , Object [ ] parameters ) throws NoSuchMethodException , IllegalArgumentException , IllegalAccessException , InvocationTargetException { MethodParameterPair pair = getMethodParameterPairIgnoreCase ( object . getClass ( ) , methodName , parameters ) ; r...
call of a method from given object
23,409
public static MethodParameterPair getMethodParameterPairIgnoreCase ( Class objectClass , String methodName , Object [ ] parameters ) throws NoSuchMethodException { if ( parameters == null ) parameters = new Object [ 0 ] ; Class [ ] parameterClasses = new Class [ parameters . length ] ; for ( int i = 0 ; i < parameters ...
search the matching method to defined Method Name also translate parameters for matching
23,410
private static Object compareClasses ( Object parameter , Class trgClass ) { Class srcClass = parameter . getClass ( ) ; trgClass = primitiveToWrapperType ( trgClass ) ; try { if ( parameter instanceof ObjectWrap ) parameter = ( ( ObjectWrap ) parameter ) . getEmbededObject ( ) ; if ( srcClass == trgClass ) return para...
compare parameter with whished parameter class and convert parameter to whished type
23,411
private static Class primitiveToWrapperType ( Class clazz ) { if ( clazz == null ) return null ; else if ( clazz . isPrimitive ( ) ) { if ( clazz . getName ( ) . equals ( "boolean" ) ) return Boolean . class ; else if ( clazz . getName ( ) . equals ( "byte" ) ) return Byte . class ; else if ( clazz . getName ( ) . equa...
cast a primitive type class definition to his object reference type
23,412
public static Object getProperty ( Object o , String prop ) throws NoSuchFieldException , IllegalArgumentException , IllegalAccessException { Field f = getFieldIgnoreCase ( o . getClass ( ) , prop ) ; return f . get ( o ) ; }
to get a visible Property of a object
23,413
public static void setProperty ( Object o , String prop , Object value ) throws IllegalArgumentException , IllegalAccessException , NoSuchFieldException { getFieldIgnoreCase ( o . getClass ( ) , prop ) . set ( o , value ) ; }
assign a value to a visible property of a object
23,414
public static Object callStaticMethod ( Class staticClass , String methodName , Object [ ] values ) throws PageException { if ( values == null ) values = new Object [ 0 ] ; MethodParameterPair mp ; try { mp = getMethodParameterPairIgnoreCase ( staticClass , methodName , values ) ; } catch ( NoSuchMethodException e ) { ...
call of a static method of a Class
23,415
public void resetPageContext ( ) { SystemOut . printDate ( config . getOutWriter ( ) , "Reset " + pcs . size ( ) + " Unused PageContexts" ) ; pcs . clear ( ) ; Iterator < PageContextImpl > it = runningPcs . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { it . next ( ) . reset ( ) ; } }
reset the PageContexes
23,416
public void checkTimeout ( ) { if ( ! engine . allowRequestTimeout ( ) ) return ; Map < Integer , PageContextImpl > map = engine . exeRequestAsync ( ) ? runningChildPcs : runningPcs ; { Iterator < Entry < Integer , PageContextImpl > > it = map . entrySet ( ) . iterator ( ) ; PageContextImpl pc ; Entry < Integer , PageC...
check timeout of all running threads downgrade also priority from all thread run longer than 10 seconds
23,417
public void printResults ( ) { System . out . println ( "[ --- Lucee Debug Response --- ]" ) ; System . out . println ( ) ; System . out . println ( "----------------------------" ) ; System . out . println ( "| Output |" ) ; System . out . println ( "----------------------------" ) ; System . out . p...
print out the response
23,418
public void printQuery ( final Query query ) { if ( query != null ) { final String [ ] cols = query . getColumns ( ) ; final int rows = query . getRowCount ( ) ; System . out . println ( "[Query:" + query . getName ( ) + "]" ) ; for ( int i = 0 ; i < cols . length ; i ++ ) { if ( i > 0 ) System . out . print ( ", " ) ;...
print out a query
23,419
private static String [ ] toRealPath ( Config config , String dotPath ) throws ExpressionException { dotPath = dotPath . trim ( ) ; while ( dotPath . indexOf ( '.' ) == 0 ) { dotPath = dotPath . substring ( 1 ) ; } int len = - 1 ; while ( ( len = dotPath . length ( ) ) > 0 && dotPath . lastIndexOf ( '.' ) == len - 1 ) ...
translate a dot - notation path to a realpath
23,420
public static DateTime toDateTime ( Locale locale , String str , TimeZone tz , boolean useCommomDateParserAsWell ) throws PageException { DateTime dt = toDateTime ( locale , str , tz , null , useCommomDateParserAsWell ) ; if ( dt == null ) { String prefix = locale . getLanguage ( ) + "-" + locale . getCountry ( ) + "-"...
parse a string to a Datetime Object
23,421
public static DateTime toDateTime ( Locale locale , String str , TimeZone tz , DateTime defaultValue , boolean useCommomDateParserAsWell ) { str = str . trim ( ) ; tz = ThreadLocalPageContext . getTimeZone ( tz ) ; DateFormat [ ] df ; Calendar c = JREDateTimeUtil . getThreadCalendar ( locale , tz ) ; ParsePosition pp =...
parse a string to a Datetime Object returns null if can t convert
23,422
public static Time toTime ( TimeZone timeZone , Object o ) throws PageException { if ( o instanceof Time ) return ( Time ) o ; else if ( o instanceof Date ) return new TimeImpl ( ( Date ) o ) ; else if ( o instanceof Castable ) return new TimeImpl ( ( ( Castable ) o ) . castToDateTime ( ) ) ; else if ( o instanceof Str...
converts a Object to a Time Object returns null if invalid string
23,423
public static Time toTime ( TimeZone timeZone , String str , Time defaultValue ) { if ( str == null || str . length ( ) < 3 ) { return defaultValue ; } DateString ds = new DateString ( str ) ; if ( ds . isCurrent ( '{' ) && ds . isLast ( '}' ) ) { if ( ds . fwIfNext ( 't' ) ) { if ( ! ( ds . fwIfNext ( ' ' ) && ds . fw...
converts a String to a Time Object returns null if invalid string
23,424
private static DateTime parseDateTime ( String str , DateString ds , short convertingType , boolean alsoMonthString , TimeZone timeZone , DateTime defaultValue ) { int month = 0 ; int first = ds . readDigits ( ) ; if ( first == - 1 ) { if ( ! alsoMonthString ) return defaultValue ; first = ds . readMonthString ( ) ; if...
converts a String to a DateTime Object returns null if invalid string
23,425
private static DateTime readOffset ( boolean isPlus , TimeZone timeZone , DateTime dt , int years , int months , int days , int hours , int minutes , int seconds , int milliSeconds , DateString ds , boolean checkAfterLast , DateTime defaultValue ) { if ( timeZone == null ) return defaultValue ; int hourLength = ds . ge...
reads a offset definition at the end of a date string
23,426
synchronized void printBuffer ( ) throws IOException { int len = sb . length ( ) ; if ( len > 0 ) { char [ ] chars = new char [ len ] ; sb . getChars ( 0 , len , chars , 0 ) ; sb . setLength ( 0 ) ; super . write ( chars , 0 , chars . length ) ; } }
prints the characters from the buffer and resets it
23,427
boolean addToBuffer ( char c ) throws IOException { int len = sb . length ( ) ; if ( len == 0 && c != CHAR_LT ) return false ; sb . append ( c ) ; if ( ++ len >= minTagLen ) { boolean isClosingTag = ( len >= 2 && sb . charAt ( 1 ) == CHAR_SL ) ; String substr ; if ( isClosingTag ) substr = sb . substring ( 2 ) ; else s...
checks if a character is part of an open html tag or close html tag and if so adds it to the buffer otherwise returns false .
23,428
public void print ( char c ) throws IOException { boolean isWS = Character . isWhitespace ( c ) ; if ( isWS ) { if ( isFirstChar ) return ; if ( c == CHAR_RETURN ) return ; if ( sb . length ( ) > 0 ) { printBuffer ( ) ; lastChar = ( c == CHAR_NL ) ? CHAR_NL : c ; super . print ( lastChar ) ; return ; } } isFirstChar = ...
sends a character to output stream if it is not a consecutive white - space unless we re inside a PRE or TEXTAREA tag .
23,429
public HtmlEmailImpl setTextMsg ( String aText ) throws EmailException { if ( StringUtil . isEmpty ( aText ) ) { throw new EmailException ( "Invalid message supplied" ) ; } this . text = aText ; return this ; }
Set the text content .
23,430
public HtmlEmailImpl setHtmlMsg ( String aHtml ) throws EmailException { if ( StringUtil . isEmpty ( aHtml ) ) { throw new EmailException ( "Invalid message supplied" ) ; } this . html = aHtml ; return this ; }
Set the HTML content .
23,431
public void embed ( URL url , String cid , String name ) throws EmailException { try { InputStream is = url . openStream ( ) ; is . close ( ) ; } catch ( IOException e ) { throw new EmailException ( "Invalid URL" ) ; } MimeBodyPart mbp = new MimeBodyPart ( ) ; try { mbp . setDataHandler ( new DataHandler ( new URLDataS...
Embeds an URL in the HTML .
23,432
public void buildMimeMessage ( ) throws EmailException { try { if ( this . isBoolHasAttachments ( ) ) { this . buildAttachments ( ) ; } else { this . buildNoAttachments ( ) ; } } catch ( MessagingException me ) { throw new EmailException ( me ) ; } super . buildMimeMessage ( ) ; }
Does the work of actually building the email .
23,433
public synchronized void put ( IPRangeNode < Map > ipr , boolean doCheck ) { IPRangeNode parent = ipr . isV4 ( ) ? ipv4 : ipv6 ; parent . addChild ( ipr , doCheck ) ; version ++ ; isSorted = false ; }
all added data should go through this method
23,434
public IPRangeNode get ( InetAddress addr ) { if ( version == 0 ) return null ; IPRangeNode node = isV4 ( addr ) ? ipv4 : ipv6 ; if ( ! this . isSorted ) this . optimize ( ) ; return node . findFast ( addr ) ; }
returns a single best matching node for the given address
23,435
public String getWsdlFile ( ) { if ( meta == null ) return null ; return ( String ) meta . get ( WSDL_FILE , null ) ; }
returns null if there is no wsdlFile defined
23,436
public byte [ ] toByteArray ( ) { byte [ ] p = new byte [ 48 ] ; p [ 0 ] = ( byte ) ( leapIndicator << 6 | version << 3 | mode ) ; p [ 1 ] = ( byte ) stratum ; p [ 2 ] = pollInterval ; p [ 3 ] = precision ; int l = ( int ) ( rootDelay * 65536.0 ) ; p [ 4 ] = ( byte ) ( ( l >> 24 ) & 0xFF ) ; p [ 5 ] = ( byte ) ( ( l >>...
This method constructs the data bytes of a raw NTP packet .
23,437
public static void encodeTimestamp ( byte [ ] array , int pointer , double timestamp ) { for ( int i = 0 ; i < 8 ; i ++ ) { double base = Math . pow ( 2 , ( 3 - i ) * 8 ) ; array [ pointer + i ] = ( byte ) ( timestamp / base ) ; timestamp = timestamp - ( unsignedByteToShort ( array [ pointer + i ] ) * base ) ; } array ...
Encodes a timestamp in the specified position in the message
23,438
public static String referenceIdentifierToString ( byte [ ] ref , short stratum , byte version ) { if ( stratum == 0 || stratum == 1 ) { return new String ( ref ) ; } else if ( version == 3 ) { return unsignedByteToShort ( ref [ 0 ] ) + "." + unsignedByteToShort ( ref [ 1 ] ) + "." + unsignedByteToShort ( ref [ 2 ] ) +...
Returns a string representation of a reference identifier according to the rules set out in RFC 2030 .
23,439
public static int compare ( Object left , Object right ) throws PageException { if ( left instanceof String ) return compare ( ( String ) left , right ) ; else if ( left instanceof Number ) return compare ( ( ( Number ) left ) . doubleValue ( ) , right ) ; else if ( left instanceof Boolean ) return compare ( ( ( Boolea...
compares two Objects
23,440
public static int compare ( String left , String right ) { if ( Decision . isNumber ( left ) ) { if ( Decision . isNumber ( right ) ) { if ( left . length ( ) > 9 || right . length ( ) > 9 ) { try { return new BigDecimal ( left ) . compareTo ( new BigDecimal ( right ) ) ; } catch ( Throwable t ) { ExceptionUtil . rethr...
compares a String with a String
23,441
public static int compare ( String left , double right ) { if ( Decision . isNumber ( left ) ) { if ( left . length ( ) > 9 ) { try { return new BigDecimal ( left ) . compareTo ( new BigDecimal ( Caster . toString ( right ) ) ) ; } catch ( Exception e ) { } } return compare ( Caster . toDoubleValue ( left , Double . Na...
compares a String with a double
23,442
public static int compare ( Date left , String right ) throws PageException { if ( Decision . isNumber ( right ) ) return compare ( left . getTime ( ) / 1000 , Caster . toDoubleValue ( right ) ) ; DateTime dt = DateCaster . toDateAdvanced ( right , DateCaster . CONVERTING_TYPE_OFFSET , null , null ) ; if ( dt != null )...
compares a Date with a String
23,443
public static int compare ( Date left , double right ) { return compare ( left . getTime ( ) / 1000 , DateTimeUtil . getInstance ( ) . toDateTime ( right ) . getTime ( ) / 1000 ) ; }
compares a Date with a double
23,444
public static int compare ( Date left , Date right ) { return compare ( left . getTime ( ) / 1000 , right . getTime ( ) / 1000 ) ; }
compares a Date with a Date
23,445
public static double exponent ( Object left , Object right ) throws PageException { return StrictMath . pow ( Caster . toDoubleValue ( left ) , Caster . toDoubleValue ( right ) ) ; }
calculate the exponent of the left value
23,446
public static CharSequence concat ( CharSequence left , CharSequence right ) { if ( left instanceof Appendable ) { try { ( ( Appendable ) left ) . append ( right ) ; return left ; } catch ( IOException e ) { } } return new StringBuilder ( left ) . append ( right ) ; }
concat 2 CharSequences
23,447
public static void visitLine ( BytecodeContext bc , Position pos ) { if ( pos != null ) { visitLine ( bc , pos . line ) ; } }
visit line number
23,448
public static void writeOutSilent ( Expression value , BytecodeContext bc , int mode ) throws TransformerException { Position start = value . getStart ( ) ; Position end = value . getEnd ( ) ; value . setStart ( null ) ; value . setEnd ( null ) ; value . writeOut ( bc , mode ) ; value . setStart ( start ) ; value . set...
write out expression without LNT
23,449
public static void addTagMetaData ( ConfigWebImpl cw , lucee . commons . io . log . Log log ) { if ( true ) return ; PageContextImpl pc = null ; try { pc = ThreadUtil . createPageContext ( cw , DevNullOutputStream . DEV_NULL_OUTPUT_STREAM , "localhost" , "/" , "" , new Cookie [ 0 ] , new Pair [ 0 ] , null , new Pair [ ...
load metadata from cfc based custom tags and add the info to the tag
23,450
public static Object invokeBIF ( PageContext pc , Object [ ] args , String className , String bundleName , String bundleVersion ) throws PageException { try { Class < ? > clazz = ClassUtil . loadClassByBundle ( className , bundleName , bundleVersion , pc . getConfig ( ) . getIdentification ( ) ) ; BIF bif ; if ( Reflec...
used by the bytecode builded
23,451
public void setCredential ( String username , String password ) { if ( username != null ) { env . put ( "java.naming.security.principal" , username ) ; env . put ( "java.naming.security.credentials" , password ) ; } else { env . remove ( "java.naming.security.principal" ) ; env . remove ( "java.naming.security.credenti...
sets username password for the connection
23,452
public void setSecureLevel ( short secureLevel ) throws ClassException { if ( secureLevel == SECURE_CFSSL_BASIC ) { env . put ( "java.naming.security.protocol" , "ssl" ) ; env . put ( "java.naming.ldap.factory.socket" , "javax.net.ssl.SSLSocketFactory" ) ; ClassUtil . loadClass ( "com.sun.net.ssl.internal.ssl.Provider"...
sets the secure Level
23,453
public void setReferral ( int referral ) { if ( referral > 0 ) { env . put ( "java.naming.referral" , "follow" ) ; env . put ( "java.naming.ldap.referral.limit" , Caster . toString ( referral ) ) ; } else { env . put ( "java.naming.referral" , "ignore" ) ; env . remove ( "java.naming.ldap.referral.limit" ) ; } }
sets thr referral
23,454
public void add ( String dn , String attributes , String delimiter , String seperator ) throws NamingException , PageException { DirContext ctx = new InitialDirContext ( env ) ; ctx . createSubcontext ( dn , toAttributes ( attributes , delimiter , seperator ) ) ; ctx . close ( ) ; }
adds LDAP entries to LDAP server
23,455
public void delete ( String dn ) throws NamingException { DirContext ctx = new InitialDirContext ( env ) ; ctx . destroySubcontext ( dn ) ; ctx . close ( ) ; }
deletes LDAP entries on an LDAP server
23,456
public void modifydn ( String dn , String attributes ) throws NamingException { DirContext ctx = new InitialDirContext ( env ) ; ctx . rename ( dn , attributes ) ; ctx . close ( ) ; }
modifies distinguished name attribute for LDAP entries on LDAP server
23,457
public PageException execute ( String id ) { SpoolerTask task = getTaskById ( openDirectory , id ) ; if ( task == null ) task = getTaskById ( closedDirectory , id ) ; if ( task != null ) { return execute ( task ) ; } return null ; }
execute task by id and return eror throwd by task
23,458
protected static InternetAddress [ ] add ( InternetAddress [ ] oldArr , InternetAddress newValue ) { if ( oldArr == null ) return new InternetAddress [ ] { newValue } ; InternetAddress [ ] tmp = new InternetAddress [ oldArr . length + 1 ] ; for ( int i = 0 ; i < oldArr . length ; i ++ ) { tmp [ i ] = oldArr [ i ] ; } t...
creates a new expanded array and return it ;
23,459
private static void clean ( Config config , Attachment [ ] attachmentz ) { if ( attachmentz != null ) for ( int i = 0 ; i < attachmentz . length ; i ++ ) { if ( attachmentz [ i ] . isRemoveAfterSend ( ) ) { Resource res = config . getResource ( attachmentz [ i ] . getAbsolutePath ( ) ) ; ResourceUtil . removeEL ( res ,...
remove all atttachements that are marked to remove
23,460
public Boolean isWriteLocked ( K token ) { RWLock < K > lock = locks . get ( token ) ; if ( lock == null ) return null ; return lock . isWriteLocked ( ) ; }
Queries if the write lock is held by any thread on given lock token returns null when lock with this token does not exists
23,461
public static DateFormat [ ] getCFMLFormats ( TimeZone tz , boolean lenient ) { String id = "cfml-" + Locale . ENGLISH . toString ( ) + "-" + tz . getID ( ) + "-" + lenient ; DateFormat [ ] df = formats . get ( id ) ; if ( df == null ) { df = new SimpleDateFormat [ ] { new SimpleDateFormat ( "EEE MMM dd HH:mm:ss z yyyy...
CFML Supported LS Formats
23,462
public void setMode ( String mode ) throws PageException { try { this . mode = ModeUtil . toOctalMode ( mode ) ; } catch ( IOException e ) { throw Caster . toPageException ( e ) ; } }
set the value mode Used with action = Create to define the permissions for a directory on UNIX and Linux platforms . Ignored on Windows . Options correspond to the octal values of the UNIX chmod command . From left to right permissions are assigned for owner group and other .
23,463
public void setNameconflict ( String nameconflict ) throws ApplicationException { this . nameconflict = FileUtil . toNameConflict ( nameconflict , NAMECONFLICT_UNDEFINED | NAMECONFLICT_ERROR | NAMECONFLICT_OVERWRITE , NAMECONFLICT_DEFAULT ) ; }
set the value nameconflict Action to take if destination directory is the same as that of a file in the directory .
23,464
public static void actionRename ( PageContext pc , Resource directory , String strNewdirectory , String serverPassword , boolean createPath , Object acl , String storage ) throws PageException { SecurityManager securityManager = pc . getConfig ( ) . getSecurityManager ( ) ; securityManager . checkFileLocation ( pc . ge...
rename a directory to a new Name
23,465
public void append ( String str ) { if ( str == null ) return ; int restLength = buffer . length - pos ; if ( str . length ( ) < restLength ) { str . getChars ( 0 , str . length ( ) , buffer , pos ) ; pos += str . length ( ) ; } else { str . getChars ( 0 , restLength , buffer , pos ) ; curr . next = new Entity ( buffer...
Method to append a string to char buffer
23,466
public char [ ] toCharArray ( ) { Entity e = root ; char [ ] chrs = new char [ size ( ) ] ; int off = 0 ; while ( e . next != null ) { e = e . next ; System . arraycopy ( e . data , 0 , chrs , off , e . data . length ) ; off += e . data . length ; } System . arraycopy ( buffer , 0 , chrs , off , pos ) ; return chrs ; }
return content of the Char Buffer as char array
23,467
public void clear ( ) { if ( size ( ) == 0 ) return ; buffer = new char [ buffer . length ] ; root . next = null ; pos = 0 ; length = 0 ; curr = root ; }
clear the content of the buffer
23,468
private AFTPClient actionExistsDir ( ) throws PageException , IOException { required ( "directory" , directory ) ; AFTPClient client = getClient ( ) ; boolean res = existsDir ( client , directory ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( RETURN_VALUE , Caster . toBoolean ( res ) ) ; cfftp . setEL ( SUC...
check if a directory exists or not
23,469
private AFTPClient actionExistsFile ( ) throws PageException , IOException { required ( "remotefile" , remotefile ) ; AFTPClient client = getClient ( ) ; FTPFile file = existsFile ( client , remotefile , true ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( RETURN_VALUE , Caster . toBoolean ( file != null && ...
check if a file exists or not
23,470
private AFTPClient actionExists ( ) throws PageException , IOException { required ( "item" , item ) ; AFTPClient client = getClient ( ) ; FTPFile file = existsFile ( client , item , false ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( RETURN_VALUE , Caster . toBoolean ( file != null ) ) ; cfftp . setEL ( SU...
check if a file or directory exists
23,471
private AFTPClient actionRemove ( ) throws IOException , PageException { required ( "item" , item ) ; AFTPClient client = getClient ( ) ; client . deleteFile ( item ) ; writeCfftp ( client ) ; return client ; }
removes a file on the server
23,472
private AFTPClient actionRename ( ) throws PageException , IOException { required ( "existing" , existing ) ; required ( "new" , _new ) ; AFTPClient client = getClient ( ) ; client . rename ( existing , _new ) ; writeCfftp ( client ) ; return client ; }
rename a file on the server
23,473
private AFTPClient actionPutFile ( ) throws IOException , PageException { required ( "remotefile" , remotefile ) ; required ( "localfile" , localfile ) ; AFTPClient client = getClient ( ) ; Resource local = ResourceUtil . toResourceExisting ( pageContext , localfile ) ; InputStream is = null ; try { is = IOUtil . toBuf...
copy a local file to server
23,474
private AFTPClient actionGetFile ( ) throws PageException , IOException { required ( "remotefile" , remotefile ) ; required ( "localfile" , localfile ) ; AFTPClient client = getClient ( ) ; Resource local = ResourceUtil . toResourceExistingParent ( pageContext , localfile ) ; pageContext . getConfig ( ) . getSecurityMa...
gets a file from server and copy it local
23,475
private AFTPClient actionGetCurrentURL ( ) throws PageException , IOException { AFTPClient client = getClient ( ) ; String pwd = client . printWorkingDirectory ( ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( "returnValue" , client . getPrefix ( ) + "://" + client . getRemoteAddress ( ) . getHostName ( ) + ...
get url of the working directory
23,476
private AFTPClient actionGetCurrentDir ( ) throws PageException , IOException { AFTPClient client = getClient ( ) ; String pwd = client . printWorkingDirectory ( ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( "returnValue" , pwd ) ; return client ; }
get path from the working directory
23,477
private AFTPClient actionChangeDir ( ) throws IOException , PageException { required ( "directory" , directory ) ; AFTPClient client = getClient ( ) ; client . changeWorkingDirectory ( directory ) ; writeCfftp ( client ) ; return client ; }
change working directory
23,478
private AFTPClient actionRemoveDir ( ) throws IOException , PageException { required ( "directory" , directory ) ; AFTPClient client = getClient ( ) ; if ( recursive ) { removeRecursive ( client , directory , FTPFile . DIRECTORY_TYPE ) ; } else client . removeDirectory ( directory ) ; writeCfftp ( client ) ; return cli...
removes a remote directory on server
23,479
private AFTPClient actionCreateDir ( ) throws IOException , PageException { required ( "directory" , directory ) ; AFTPClient client = getClient ( ) ; client . makeDirectory ( directory ) ; writeCfftp ( client ) ; return client ; }
create a remote directory
23,480
private AFTPClient actionListDir ( ) throws PageException , IOException { required ( "name" , name ) ; required ( "directory" , directory ) ; AFTPClient client = getClient ( ) ; FTPFile [ ] files = client . listFiles ( directory ) ; if ( files == null ) files = new FTPFile [ 0 ] ; pageContext . setVariable ( name , toQ...
List data of a ftp connection
23,481
private AFTPClient actionOpen ( ) throws IOException , PageException { required ( "server" , server ) ; required ( "username" , username ) ; AFTPClient client = getClient ( ) ; writeCfftp ( client ) ; return client ; }
Opens a FTP Connection
23,482
private AFTPClient actionClose ( ) throws PageException { FTPConnection conn = _createConnection ( ) ; AFTPClient client = pool . remove ( conn ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( "succeeded" , Caster . toBoolean ( client != null ) ) ; return client ; }
close a existing ftp connection
23,483
private Struct writeCfftp ( AFTPClient client ) throws PageException { Struct cfftp = new StructImpl ( ) ; if ( result == null ) pageContext . variablesScope ( ) . setEL ( CFFTP , cfftp ) ; else pageContext . setVariable ( result , cfftp ) ; if ( client == null ) { cfftp . setEL ( SUCCEEDED , Boolean . FALSE ) ; cfftp ...
writes cfftp variable
23,484
private boolean checkCompletion ( AFTPClient client ) throws ApplicationException { boolean isPositiveCompletion = client . isPositiveCompletion ( ) ; if ( isPositiveCompletion ) return false ; if ( count ++ < retrycount ) return true ; if ( stoponerror ) { throw new lucee . runtime . exp . FTPException ( action , clie...
check completion status of the client
23,485
private int getType ( Resource file ) { if ( transferMode == FTPConstant . TRANSFER_MODE_BINARY ) return AFTPClient . FILE_TYPE_BINARY ; else if ( transferMode == FTPConstant . TRANSFER_MODE_ASCCI ) return AFTPClient . FILE_TYPE_TEXT ; else { String ext = ResourceUtil . getExtension ( file , null ) ; if ( ext == null |...
get FTP . ... _FILE_TYPE
23,486
public Pair addElseIf ( ExprBoolean condition , Statement body , Position start , Position end ) { Pair pair ; ifs . add ( pair = new Pair ( condition , body , start , end ) ) ; body . setParent ( this ) ; return pair ; }
adds a else statement
23,487
public Pair setElse ( Statement body , Position start , Position end ) { _else = new Pair ( null , body , start , end ) ; body . setParent ( this ) ; return _else ; }
sets the else Block of the condition
23,488
public static void copy ( Struct source , Struct target , boolean overwrite ) { Iterator < Entry < Key , Object > > it = source . entryIterator ( ) ; Entry < Key , Object > e ; while ( it . hasNext ( ) ) { e = it . next ( ) ; if ( overwrite || ! target . containsKey ( e . getKey ( ) ) ) target . setEL ( e . getKey ( ) ...
copy data from source struct to target struct
23,489
public static java . util . Collection < ? > values ( Struct sct ) { ArrayList < Object > arr = new ArrayList < Object > ( ) ; Iterator < Object > it = sct . valueIterator ( ) ; while ( it . hasNext ( ) ) { arr . add ( it . next ( ) ) ; } return arr ; }
create a value return value out of a struct
23,490
public static long sizeOf ( Struct sct ) { Iterator < Entry < Key , Object > > it = sct . entryIterator ( ) ; Entry < Key , Object > e ; long size = 0 ; while ( it . hasNext ( ) ) { e = it . next ( ) ; size += SizeOf . size ( e . getKey ( ) ) ; size += SizeOf . size ( e . getValue ( ) ) ; } return size ; }
return the size of given struct size of values + keys
23,491
public static void removeValue ( Map map , Object value ) { Iterator it = map . entrySet ( ) . iterator ( ) ; Map . Entry entry ; while ( it . hasNext ( ) ) { entry = ( Entry ) it . next ( ) ; if ( entry . getValue ( ) == value ) it . remove ( ) ; } }
remove every entry hat has this value
23,492
private void writeOutTypeNormal ( BytecodeContext bc ) throws TransformerException { ParseBodyVisitor pbv = new ParseBodyVisitor ( ) ; pbv . visitBegin ( bc ) ; getBody ( ) . writeOut ( bc ) ; pbv . visitEnd ( bc ) ; }
write out normal query
23,493
public void setQuery ( String query ) throws PageException { this . query = Caster . toQuery ( pageContext . getVariable ( query ) ) ; }
set the value query Name of the cfquery from which to draw data .
23,494
public Reflections merge ( final Reflections reflections ) { if ( reflections . store != null ) { for ( String indexName : reflections . store . keySet ( ) ) { Multimap < String , String > index = reflections . store . get ( indexName ) ; for ( String key : index . keySet ( ) ) { for ( String string : index . get ( key...
merges a Reflections instance metadata into this instance
23,495
public Set < Method > getMethodsReturn ( Class returnType ) { return getMethodsFromDescriptors ( store . get ( index ( MethodParameterScanner . class ) , names ( returnType ) ) , loaders ( ) ) ; }
get methods with return type match given type
23,496
public Set < Method > getMethodsWithAnyParamAnnotated ( Class < ? extends Annotation > annotation ) { return getMethodsFromDescriptors ( store . get ( index ( MethodParameterScanner . class ) , annotation . getName ( ) ) , loaders ( ) ) ; }
get methods with any parameter annotated with given annotation
23,497
public Set < Method > getMethodsWithAnyParamAnnotated ( Annotation annotation ) { return filter ( getMethodsWithAnyParamAnnotated ( annotation . annotationType ( ) ) , withAnyParameterAnnotation ( annotation ) ) ; }
get methods with any parameter annotated with given annotation including annotation member values matching
23,498
public Set < Constructor > getConstructorsWithAnyParamAnnotated ( Class < ? extends Annotation > annotation ) { return getConstructorsFromDescriptors ( store . get ( index ( MethodParameterScanner . class ) , annotation . getName ( ) ) , loaders ( ) ) ; }
get constructors with any parameter annotated with given annotation
23,499
public Set < Constructor > getConstructorsWithAnyParamAnnotated ( Annotation annotation ) { return filter ( getConstructorsWithAnyParamAnnotated ( annotation . annotationType ( ) ) , withAnyParameterAnnotation ( annotation ) ) ; }
get constructors with any parameter annotated with given annotation including annotation member values matching