idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
154,100 | public String DsMakeSpn ( String serviceClass , String serviceName , String instanceName , short instancePort , String referrer ) throws LastErrorException { IntByReference spnLength = new IntByReference ( 2048 ) ; char [ ] spn = new char [ spnLength . getValue ( ) ] ; final int ret = NTDSAPI . instance . DsMakeSpnW ( ... | Convenience wrapper for NTDSAPI DsMakeSpn with Java friendly string and exception handling . |
154,101 | public static long int8 ( byte [ ] bytes , int idx ) { return ( ( long ) ( bytes [ idx + 0 ] & 255 ) << 56 ) + ( ( long ) ( bytes [ idx + 1 ] & 255 ) << 48 ) + ( ( long ) ( bytes [ idx + 2 ] & 255 ) << 40 ) + ( ( long ) ( bytes [ idx + 3 ] & 255 ) << 32 ) + ( ( long ) ( bytes [ idx + 4 ] & 255 ) << 24 ) + ( ( long ) ( ... | Parses a long value from the byte array . |
154,102 | public static int int4 ( byte [ ] bytes , int idx ) { return ( ( bytes [ idx ] & 255 ) << 24 ) + ( ( bytes [ idx + 1 ] & 255 ) << 16 ) + ( ( bytes [ idx + 2 ] & 255 ) << 8 ) + ( ( bytes [ idx + 3 ] & 255 ) ) ; } | Parses an int value from the byte array . |
154,103 | public static void int8 ( byte [ ] target , int idx , long value ) { target [ idx + 0 ] = ( byte ) ( value >>> 56 ) ; target [ idx + 1 ] = ( byte ) ( value >>> 48 ) ; target [ idx + 2 ] = ( byte ) ( value >>> 40 ) ; target [ idx + 3 ] = ( byte ) ( value >>> 32 ) ; target [ idx + 4 ] = ( byte ) ( value >>> 24 ) ; target... | Encodes a long value to the byte array . |
154,104 | public static Encoding getJVMEncoding ( String jvmEncoding ) { if ( "UTF-8" . equals ( jvmEncoding ) ) { return new UTF8Encoding ( ) ; } if ( Charset . isSupported ( jvmEncoding ) ) { return new Encoding ( jvmEncoding ) ; } else { return DEFAULT_ENCODING ; } } | Construct an Encoding for a given JVM encoding . |
154,105 | public static Encoding getDatabaseEncoding ( String databaseEncoding ) { if ( "UTF8" . equals ( databaseEncoding ) ) { return UTF8_ENCODING ; } String [ ] candidates = encodings . get ( databaseEncoding ) ; if ( candidates != null ) { for ( String candidate : candidates ) { LOGGER . log ( Level . FINEST , "Search encod... | Construct an Encoding for a given database encoding . |
154,106 | public byte [ ] encode ( String s ) throws IOException { if ( s == null ) { return null ; } return s . getBytes ( encoding ) ; } | Encode a string to an array of bytes . |
154,107 | public String decode ( byte [ ] encodedString , int offset , int length ) throws IOException { return new String ( encodedString , offset , length , encoding ) ; } | Decode an array of bytes into a string . |
154,108 | public static Method getFunction ( String functionName ) { return functionMap . get ( "sql" + functionName . toLowerCase ( Locale . US ) ) ; } | get Method object implementing the given function . |
154,109 | public static String sqlconcat ( List < ? > parsedArgs ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( '(' ) ; for ( int iArg = 0 ; iArg < parsedArgs . size ( ) ; iArg ++ ) { buf . append ( parsedArgs . get ( iArg ) ) ; if ( iArg != ( parsedArgs . size ( ) - 1 ) ) { buf . append ( " || " ) ; } } return b... | concat translation . |
154,110 | public static String sqlinsert ( List < ? > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) != 4 ) { throw new PSQLException ( GT . tr ( "{0} function takes four and only four argument." , "insert" ) , PSQLState . SYNTAX_ERROR ) ; } StringBuilder buf = new StringBuilder ( ) ; buf . append ( "overlay(" ) ;... | insert to overlay translation . |
154,111 | public static String sqllocate ( List < ? > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) == 2 ) { return "position(" + parsedArgs . get ( 0 ) + " in " + parsedArgs . get ( 1 ) + ")" ; } else if ( parsedArgs . size ( ) == 3 ) { String tmp = "position(" + parsedArgs . get ( 0 ) + " in substring(" + parse... | locate translation . |
154,112 | public static String sqlsubstring ( List < ? > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) == 2 ) { return "substr(" + parsedArgs . get ( 0 ) + "," + parsedArgs . get ( 1 ) + ")" ; } else if ( parsedArgs . size ( ) == 3 ) { return "substr(" + parsedArgs . get ( 0 ) + "," + parsedArgs . get ( 1 ) + ","... | substring to substr translation . |
154,113 | public static String sqlcurdate ( List < ? > parsedArgs ) throws SQLException { if ( ! parsedArgs . isEmpty ( ) ) { throw new PSQLException ( GT . tr ( "{0} function doesn''t take any argument." , "curdate" ) , PSQLState . SYNTAX_ERROR ) ; } return "current_date" ; } | curdate to current_date translation . |
154,114 | public static String sqlmonthname ( List < ? > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) != 1 ) { throw new PSQLException ( GT . tr ( "{0} function takes one and only one argument." , "monthname" ) , PSQLState . SYNTAX_ERROR ) ; } return "to_char(" + parsedArgs . get ( 0 ) + ",'Month')" ; } | monthname translation . |
154,115 | public static String sqltimestampadd ( List < ? > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) != 3 ) { throw new PSQLException ( GT . tr ( "{0} function takes three and only three arguments." , "timestampadd" ) , PSQLState . SYNTAX_ERROR ) ; } String interval = EscapedFunctions . constantToInterval ( ... | time stamp add . |
154,116 | public static Method getFunction ( String functionName ) { Method method = FUNCTION_MAP . get ( functionName ) ; if ( method != null ) { return method ; } String nameLower = functionName . toLowerCase ( Locale . US ) ; if ( nameLower == functionName ) { return null ; } method = FUNCTION_MAP . get ( nameLower ) ; if ( m... | get Method object implementing the given function |
154,117 | public static void sqlceiling ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { singleArgumentFunctionCall ( buf , "ceil(" , "ceiling" , parsedArgs ) ; } | ceiling to ceil translation |
154,118 | public static void sqllog ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { singleArgumentFunctionCall ( buf , "ln(" , "log" , parsedArgs ) ; } | log to ln translation |
154,119 | public static void sqllog10 ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { singleArgumentFunctionCall ( buf , "log(" , "log10" , parsedArgs ) ; } | log10 to log translation |
154,120 | public static void sqlpower ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { twoArgumentsFunctionCall ( buf , "pow(" , "power" , parsedArgs ) ; } | power to pow translation |
154,121 | public static void sqltruncate ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { twoArgumentsFunctionCall ( buf , "trunc(" , "truncate" , parsedArgs ) ; } | truncate to trunc translation |
154,122 | public static void sqlchar ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { singleArgumentFunctionCall ( buf , "chr(" , "char" , parsedArgs ) ; } | char to chr translation |
154,123 | public static void sqllcase ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { singleArgumentFunctionCall ( buf , "lower(" , "lcase" , parsedArgs ) ; } | lcase to lower translation |
154,124 | public static void sqlucase ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { singleArgumentFunctionCall ( buf , "upper(" , "ucase" , parsedArgs ) ; } | ucase to upper translation |
154,125 | public static void sqlcurdate ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { zeroArgumentFunctionCall ( buf , "current_date" , "curdate" , parsedArgs ) ; } | curdate to current_date translation |
154,126 | public static void sqlcurtime ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { zeroArgumentFunctionCall ( buf , "current_time" , "curtime" , parsedArgs ) ; } | curtime to current_time translation |
154,127 | public static void sqltimestampadd ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) != 3 ) { throw new PSQLException ( GT . tr ( "{0} function takes three and only three arguments." , "timestampadd" ) , PSQLState . SYNTAX_ERROR ) ; } buf . append ( '(' ... | time stamp add |
154,128 | private static boolean areSameTsi ( String a , String b ) { return a . length ( ) == b . length ( ) && b . length ( ) > SQL_TSI_ROOT . length ( ) && a . regionMatches ( true , SQL_TSI_ROOT . length ( ) , b , SQL_TSI_ROOT . length ( ) , b . length ( ) - SQL_TSI_ROOT . length ( ) ) ; } | Compares two TSI intervals . It is |
154,129 | public static void sqltimestampdiff ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { if ( parsedArgs . size ( ) != 3 ) { throw new PSQLException ( GT . tr ( "{0} function takes three and only three arguments." , "timestampdiff" ) , PSQLState . SYNTAX_ERROR ) ; } buf . append ( "e... | time stamp diff |
154,130 | private void setPGobject ( int parameterIndex , PGobject x ) throws SQLException { String typename = x . getType ( ) ; int oid = connection . getTypeInfo ( ) . getPGType ( typename ) ; if ( oid == Oid . UNSPECIFIED ) { throw new PSQLException ( GT . tr ( "Unknown type {0}." , typename ) , PSQLState . INVALID_PARAMETER_... | Helper method for setting parameters to PGobject subclasses . |
154,131 | protected synchronized int convertArrayToBaseOid ( int oid ) { Integer i = pgArrayToPgType . get ( oid ) ; if ( i == null ) { return oid ; } return i ; } | Return the oid of the array s base element if it s an array if not return the provided oid . This doesn t do any database lookups so it s only useful for the originally provided type mappings . This is fine for it s intended uses where we only have intimate knowledge of types that are already known to the driver . |
154,132 | public boolean requiresQuotingSqlType ( int sqlType ) throws SQLException { switch ( sqlType ) { case Types . BIGINT : case Types . DOUBLE : case Types . FLOAT : case Types . INTEGER : case Types . REAL : case Types . SMALLINT : case Types . TINYINT : case Types . NUMERIC : case Types . DECIMAL : return false ; } retur... | Returns true if particular sqlType requires quoting . This method is used internally by the driver so it might disappear without notice . |
154,133 | public boolean hasMessagePending ( ) throws IOException { if ( pgInput . available ( ) > 0 ) { return true ; } long now = System . currentTimeMillis ( ) ; if ( now < nextStreamAvailableCheckTime && minStreamAvailableCheckDelay != 0 ) { return false ; } nextStreamAvailableCheckTime = now + minStreamAvailableCheckDelay ;... | Check for pending backend messages without blocking . Might return false when there actually are messages waiting depending on the characteristics of the underlying socket . This is used to detect asynchronous notifies from the backend when available . |
154,134 | public void setEncoding ( Encoding encoding ) throws IOException { if ( this . encoding != null && this . encoding . name ( ) . equals ( encoding . name ( ) ) ) { return ; } if ( encodingWriter != null ) { encodingWriter . close ( ) ; } this . encoding = encoding ; OutputStream interceptor = new FilterOutputStream ( pg... | Change the encoding used by this connection . |
154,135 | public void sendInteger4 ( int val ) throws IOException { int4Buf [ 0 ] = ( byte ) ( val >>> 24 ) ; int4Buf [ 1 ] = ( byte ) ( val >>> 16 ) ; int4Buf [ 2 ] = ( byte ) ( val >>> 8 ) ; int4Buf [ 3 ] = ( byte ) ( val ) ; pgOutput . write ( int4Buf ) ; } | Sends a 4 - byte integer to the back end . |
154,136 | public int receiveInteger4 ( ) throws IOException { if ( pgInput . read ( int4Buf ) != 4 ) { throw new EOFException ( ) ; } return ( int4Buf [ 0 ] & 0xFF ) << 24 | ( int4Buf [ 1 ] & 0xFF ) << 16 | ( int4Buf [ 2 ] & 0xFF ) << 8 | int4Buf [ 3 ] & 0xFF ; } | Receives a four byte integer from the backend . |
154,137 | public String receiveString ( int len ) throws IOException { if ( ! pgInput . ensureBytes ( len ) ) { throw new EOFException ( ) ; } String res = encoding . decode ( pgInput . getBuffer ( ) , pgInput . getIndex ( ) , len ) ; pgInput . skip ( len ) ; return res ; } | Receives a fixed - size string from the backend . |
154,138 | public EncodingPredictor . DecodeResult receiveErrorString ( int len ) throws IOException { if ( ! pgInput . ensureBytes ( len ) ) { throw new EOFException ( ) ; } EncodingPredictor . DecodeResult res ; try { String value = encoding . decode ( pgInput . getBuffer ( ) , pgInput . getIndex ( ) , len ) ; res = new Encodin... | Receives a fixed - size string from the backend and tries to avoid UTF - 8 decode failed errors . |
154,139 | public String receiveString ( ) throws IOException { int len = pgInput . scanCStringLength ( ) ; String res = encoding . decode ( pgInput . getBuffer ( ) , pgInput . getIndex ( ) , len - 1 ) ; pgInput . skip ( len ) ; return res ; } | Receives a null - terminated string from the backend . If we don t see a null then we assume something has gone wrong . |
154,140 | public byte [ ] [ ] receiveTupleV3 ( ) throws IOException , OutOfMemoryError { int msgSize = receiveInteger4 ( ) ; int nf = receiveInteger2 ( ) ; byte [ ] [ ] answer = new byte [ nf ] [ ] ; OutOfMemoryError oom = null ; for ( int i = 0 ; i < nf ; ++ i ) { int size = receiveInteger4 ( ) ; if ( size != - 1 ) { try { answ... | Read a tuple from the back end . A tuple is a two dimensional array of bytes . This variant reads the V3 protocol s tuple representation . |
154,141 | public void receive ( byte [ ] buf , int off , int siz ) throws IOException { int s = 0 ; while ( s < siz ) { int w = pgInput . read ( buf , off + s , siz - s ) ; if ( w < 0 ) { throw new EOFException ( ) ; } s += w ; } } | Reads in a given number of bytes from the backend . |
154,142 | public void sendStream ( InputStream inStream , int remaining ) throws IOException { int expectedLength = remaining ; if ( streamBuffer == null ) { streamBuffer = new byte [ 8192 ] ; } while ( remaining > 0 ) { int count = ( remaining > streamBuffer . length ? streamBuffer . length : remaining ) ; int readCount ; try {... | Copy data from an input stream to the connection . |
154,143 | public void receiveEOF ( ) throws SQLException , IOException { int c = pgInput . read ( ) ; if ( c < 0 ) { return ; } throw new PSQLException ( GT . tr ( "Expected an EOF from server, got: {0}" , c ) , PSQLState . COMMUNICATION_ERROR ) ; } | Consume an expected EOF from the backend . |
154,144 | public static void reportHostStatus ( HostSpec hostSpec , HostStatus hostStatus ) { long now = currentTimeMillis ( ) ; synchronized ( hostStatusMap ) { HostSpecStatus hostSpecStatus = hostStatusMap . get ( hostSpec ) ; if ( hostSpecStatus == null ) { hostSpecStatus = new HostSpecStatus ( hostSpec ) ; hostStatusMap . pu... | Store the actual observed host status . |
154,145 | static List < HostSpec > getCandidateHosts ( HostSpec [ ] hostSpecs , HostRequirement targetServerType , long hostRecheckMillis ) { List < HostSpec > candidates = new ArrayList < HostSpec > ( hostSpecs . length ) ; long latestAllowedUpdate = currentTimeMillis ( ) - hostRecheckMillis ; synchronized ( hostStatusMap ) { f... | Returns a list of candidate hosts that have the required targetServerType . |
154,146 | public boolean isSSPISupported ( ) { try { if ( ! Platform . isWindows ( ) ) { LOGGER . log ( Level . FINE , "SSPI not supported: non-Windows host" ) ; return false ; } Class . forName ( "waffle.windows.auth.impl.WindowsSecurityContextImpl" ) ; return true ; } catch ( NoClassDefFoundError ex ) { LOGGER . log ( Level . ... | Test whether we can attempt SSPI authentication . If false do not attempt to call any other SSPIClient methods . |
154,147 | public void continueSSPI ( int msgLength ) throws SQLException , IOException { if ( sspiContext == null ) { throw new IllegalStateException ( "Cannot continue SSPI authentication that we didn't begin" ) ; } LOGGER . log ( Level . FINEST , "Continuing SSPI negotiation" ) ; byte [ ] receivedToken = pgStream . receive ( m... | Continue an existing authentication conversation with the back - end in resonse to an authentication request of type AUTH_REQ_GSS_CONT . |
154,148 | public void dispose ( ) { if ( sspiContext != null ) { sspiContext . dispose ( ) ; sspiContext = null ; } if ( clientCredentials != null ) { clientCredentials . dispose ( ) ; clientCredentials = null ; } } | Clean up native win32 resources after completion or failure of SSPI authentication . This SSPIClient instance becomes unusable after disposal . |
154,149 | public Connection getConnection ( String user , String password ) throws SQLException { try { Connection con = DriverManager . getConnection ( getUrl ( ) , user , password ) ; if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . log ( Level . FINE , "Created a {0} for {1} at {2}" , new Object [ ] { getDescription ( )... | Gets a connection to the PostgreSQL database . The database is identified by the DataSource properties serverName databaseName and portNumber . The user to connect as is identified by the arguments user and password which override the DataSource properties by the same name . |
154,150 | public void toBytes ( byte [ ] b , int offset ) { ByteConverter . float8 ( b , offset , x ) ; ByteConverter . float8 ( b , offset + 8 , y ) ; } | Populate the byte array with PGpoint in the binary syntax expected by org . postgresql . |
154,151 | public static boolean verifyHostName ( String hostname , String pattern ) { String canonicalHostname ; if ( hostname . startsWith ( "[" ) && hostname . endsWith ( "]" ) ) { canonicalHostname = hostname . substring ( 1 , hostname . length ( ) - 1 ) ; } else { try { canonicalHostname = IDN . toASCII ( hostname ) ; } catc... | Verifies if given hostname matches pattern . |
154,152 | public String getValue ( ) { StringBuilder b = new StringBuilder ( open ? "[" : "(" ) ; for ( int p = 0 ; p < points . length ; p ++ ) { if ( p > 0 ) { b . append ( "," ) ; } b . append ( points [ p ] . toString ( ) ) ; } b . append ( open ? "]" : ")" ) ; return b . toString ( ) ; } | This returns the path in the syntax expected by org . postgresql . |
154,153 | public static boolean parseDeleteKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 6 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'd' && ( query [ offset + 1 ] | 32 ) == 'e' && ( query [ offset + 2 ] | 32 ) == 'l' && ( query [ offset + 3 ] | 32 ) == 'e' && ( query [ offset +... | Parse string to check presence of DELETE keyword regardless of case . The initial character is assumed to have been matched . |
154,154 | public static boolean parseInsertKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 7 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'i' && ( query [ offset + 1 ] | 32 ) == 'n' && ( query [ offset + 2 ] | 32 ) == 's' && ( query [ offset + 3 ] | 32 ) == 'e' && ( query [ offset +... | Parse string to check presence of INSERT keyword regardless of case . |
154,155 | public static boolean parseMoveKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 4 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'm' && ( query [ offset + 1 ] | 32 ) == 'o' && ( query [ offset + 2 ] | 32 ) == 'v' && ( query [ offset + 3 ] | 32 ) == 'e' ; } | Parse string to check presence of MOVE keyword regardless of case . |
154,156 | public static boolean parseReturningKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 9 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'r' && ( query [ offset + 1 ] | 32 ) == 'e' && ( query [ offset + 2 ] | 32 ) == 't' && ( query [ offset + 3 ] | 32 ) == 'u' && ( query [ offse... | Parse string to check presence of RETURNING keyword regardless of case . |
154,157 | public static boolean parseSelectKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 6 ) ) { return false ; } return ( query [ offset ] | 32 ) == 's' && ( query [ offset + 1 ] | 32 ) == 'e' && ( query [ offset + 2 ] | 32 ) == 'l' && ( query [ offset + 3 ] | 32 ) == 'e' && ( query [ offset +... | Parse string to check presence of SELECT keyword regardless of case . |
154,158 | public static boolean parseUpdateKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 6 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'u' && ( query [ offset + 1 ] | 32 ) == 'p' && ( query [ offset + 2 ] | 32 ) == 'd' && ( query [ offset + 3 ] | 32 ) == 'a' && ( query [ offset +... | Parse string to check presence of UPDATE keyword regardless of case . |
154,159 | public static boolean parseValuesKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 6 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'v' && ( query [ offset + 1 ] | 32 ) == 'a' && ( query [ offset + 2 ] | 32 ) == 'l' && ( query [ offset + 3 ] | 32 ) == 'u' && ( query [ offset +... | Parse string to check presence of VALUES keyword regardless of case . |
154,160 | public static boolean parseWithKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 4 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'w' && ( query [ offset + 1 ] | 32 ) == 'i' && ( query [ offset + 2 ] | 32 ) == 't' && ( query [ offset + 3 ] | 32 ) == 'h' ; } | Parse string to check presence of WITH keyword regardless of case . |
154,161 | public static boolean parseAsKeyword ( final char [ ] query , int offset ) { if ( query . length < ( offset + 2 ) ) { return false ; } return ( query [ offset ] | 32 ) == 'a' && ( query [ offset + 1 ] | 32 ) == 's' ; } | Parse string to check presence of AS keyword regardless of case . |
154,162 | private static boolean subArraysEqual ( final char [ ] arr , final int offA , final int offB , final int len ) { if ( offA < 0 || offB < 0 || offA >= arr . length || offB >= arr . length || offA + len > arr . length || offB + len > arr . length ) { return false ; } for ( int i = 0 ; i < len ; ++ i ) { if ( arr [ offA +... | Compares two sub - arrays of the given character array for equalness . If the length is zero the result is true if and only if the offsets are within the bounds of the array . |
154,163 | private static int escapeFunctionArguments ( StringBuilder newsql , String functionName , char [ ] sql , int i , boolean stdStrings ) throws SQLException { List < CharSequence > parsedArgs = new ArrayList < CharSequence > ( 3 ) ; while ( true ) { StringBuilder arg = new StringBuilder ( ) ; int lastPos = i ; i = parseSq... | Generate sql for escaped functions . |
154,164 | public Connection getConnection ( ) throws SQLException { Connection conn = super . getConnection ( ) ; if ( state == State . IDLE ) { conn . setAutoCommit ( true ) ; } ConnectionHandler handler = new ConnectionHandler ( conn ) ; return ( Connection ) Proxy . newProxyInstance ( getClass ( ) . getClassLoader ( ) , new C... | XAConnection interface . |
154,165 | public void forget ( Xid xid ) throws XAException { throw new PGXAException ( GT . tr ( "Heuristic commit/rollback not supported. forget xid={0}" , xid ) , XAException . XAER_NOTA ) ; } | Does nothing since we don t do heuristics . |
154,166 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public static void detach ( Activity activity , ViewTreeObserver . OnGlobalLayoutListener l ) { ViewGroup contentView = activity . findViewById ( android . R . id . content ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { contentView . getVi... | Remove the OnGlobalLayoutListener from the activity root view |
154,167 | public void onClickExtraThemeResolved ( final View view ) { final boolean fullScreenTheme = mFullScreenRb . isChecked ( ) ; Intent i = new Intent ( this , ChattingResolvedHandleByPlaceholderActivity . class ) ; i . putExtra ( KEY_FULL_SCREEN_THEME , fullScreenTheme ) ; startActivity ( i ) ; } | Resolved for Full Screen Theme or Translucent Status Theme . |
154,168 | public static void hidePanelAndKeyboard ( final View panelLayout ) { final Activity activity = ( Activity ) panelLayout . getContext ( ) ; final View focusView = activity . getCurrentFocus ( ) ; if ( focusView != null ) { KeyboardUtil . hideKeyboard ( activity . getCurrentFocus ( ) ) ; focusView . clearFocus ( ) ; } pa... | Hide the panel and the keyboard . |
154,169 | public static Typeface getTypeface ( Context context , IconSet iconSet ) { String path = iconSet . fontPath ( ) . toString ( ) ; if ( TYPEFACE_MAP . get ( path ) == null ) { final Typeface font = Typeface . createFromAsset ( context . getAssets ( ) , path ) ; TYPEFACE_MAP . put ( path , font ) ; } return TYPEFACE_MAP .... | Returns a reference to the requested typeface creating a new instance if none already exists |
154,170 | public static void registerDefaultIconSets ( ) { final FontAwesome fontAwesome = new FontAwesome ( ) ; final Typicon typicon = new Typicon ( ) ; final MaterialIcons materialIcons = new MaterialIcons ( ) ; REGISTERED_ICON_SETS . put ( fontAwesome . fontPath ( ) , fontAwesome ) ; REGISTERED_ICON_SETS . put ( typicon . fo... | Registers instances of the Default IconSets so that they are available throughout the whole application . Currently the default icon sets include FontAwesome and Typicon . |
154,171 | public static IconSet retrieveRegisteredIconSet ( String fontPath , boolean editMode ) { final IconSet iconSet = REGISTERED_ICON_SETS . get ( fontPath ) ; if ( iconSet == null && ! editMode ) { throw new RuntimeException ( String . format ( "Font '%s' not properly registered, please" + " see the README at https://githu... | Retrieves a registered IconSet whose font can be found in the asset directory at the given path |
154,172 | void onRadioToggle ( int index ) { for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { if ( i != index ) { BootstrapButton b = retrieveButtonChild ( i ) ; b . setSelected ( false ) ; } } } | Used for Radio Group Mode - resets all children to an unselected state apart from the calling Button . |
154,173 | public void startFlashing ( boolean forever , AnimationSpeed speed ) { Animation fadeIn = new AlphaAnimation ( 0 , 1 ) ; fadeIn . setDuration ( 50 ) ; fadeIn . setRepeatMode ( Animation . REVERSE ) ; fadeIn . setRepeatCount ( 0 ) ; if ( forever ) { fadeIn . setRepeatCount ( Animation . INFINITE ) ; } fadeIn . setStartO... | Starts a Flashing Animation on the AwesomeTextView |
154,174 | public void startRotate ( boolean clockwise , AnimationSpeed speed ) { Animation rotate ; if ( clockwise ) { rotate = new RotateAnimation ( 0 , 360 , Animation . RELATIVE_TO_SELF , 0.5f , Animation . RELATIVE_TO_SELF , 0.5f ) ; } else { rotate = new RotateAnimation ( 360 , 0 , Animation . RELATIVE_TO_SELF , 0.5f , Anim... | Starts a rotating animation on the AwesomeTextView |
154,175 | private static IconSet resolveIconSet ( String iconCode ) { CharSequence unicode ; for ( IconSet set : getRegisteredIconSets ( ) ) { if ( set . fontPath ( ) . equals ( FontAwesome . FONT_PATH ) || set . fontPath ( ) . equals ( Typicon . FONT_PATH ) || set . fontPath ( ) . equals ( MaterialIcons . FONT_PATH ) ) { contin... | Searches for the unicode character value for the Font Icon Code . This method searches all active FontIcons in the application . |
154,176 | private float measureStringWidth ( String text ) { Paint mPaint = new Paint ( ) ; mPaint . setTextSize ( baselineDropDownViewFontSize * bootstrapSize ) ; return ( float ) ( DimenUtils . dpToPixels ( mPaint . measureText ( text ) ) ) ; } | Calculating string width |
154,177 | private String getLongestString ( String [ ] array ) { int maxLength = 0 ; String longestString = null ; for ( String s : array ) { if ( s . length ( ) > maxLength ) { maxLength = s . length ( ) ; longestString = s ; } } return longestString ; } | Searching for longest string in array |
154,178 | private void addEmptyProgressBar ( ) { int whereIsEmpty = - 1 ; for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { if ( retrieveChild ( i ) != null && retrieveChild ( i ) . equals ( emptyProgressBar ) ) { whereIsEmpty = i ; } } if ( whereIsEmpty != getChildCount ( ) - 1 ) { if ( whereIsEmpty != - 1 ) { isEmptyBeingAdde... | This looks for instances of emptyProgressBar and removes them if they are not at the end and then adds one at the end if its needed . |
154,179 | public int getCumulativeProgress ( ) { int numChildren = getChildCount ( ) ; int total = 0 ; for ( int i = 0 ; i < numChildren ; i ++ ) { total += getChildProgress ( i ) ; } checkCumulativeSmallerThanMax ( maxProgress , total ) ; return total ; } | This get the total progress of all the children |
154,180 | public void setStriped ( boolean striped ) { this . striped = striped ; for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { retrieveChild ( i ) . setStriped ( striped ) ; } } | This will set all children to striped . |
154,181 | static Drawable bootstrapButton ( Context context , BootstrapBrand brand , int strokeWidth , int cornerRadius , ViewGroupPosition position , boolean showOutline , boolean rounded ) { GradientDrawable defaultGd = new GradientDrawable ( ) ; GradientDrawable activeGd = new GradientDrawable ( ) ; GradientDrawable disabledG... | Generates a background drawable for a Bootstrap Button |
154,182 | static Drawable bootstrapLabel ( Context context , BootstrapBrand bootstrapBrand , boolean rounded , float height ) { int cornerRadius = ( int ) DimenUtils . pixelsFromDpResource ( context , R . dimen . bootstrap_default_corner_radius ) ; GradientDrawable drawable = new GradientDrawable ( ) ; drawable . setColor ( boot... | Generates a Drawable for a Bootstrap Label background according to state parameters |
154,183 | static Drawable bootstrapEditText ( Context context , BootstrapBrand bootstrapBrand , float strokeWidth , float cornerRadius , boolean rounded ) { StateListDrawable drawable = new StateListDrawable ( ) ; GradientDrawable activeDrawable = new GradientDrawable ( ) ; GradientDrawable disabledDrawable = new GradientDrawabl... | Generates a Drawable for a Bootstrap Edit Text background |
154,184 | static ColorStateList bootstrapButtonText ( Context context , boolean outline , BootstrapBrand brand ) { int defaultColor = outline ? brand . defaultFill ( context ) : brand . defaultTextColor ( context ) ; int activeColor = outline ? ColorUtils . resolveColor ( android . R . color . white , context ) : brand . activeT... | Generates a colorstatelist for a bootstrap button |
154,185 | private static Drawable createArrowIcon ( Context context , int width , int height , int color , ExpandDirection expandDirection ) { Bitmap canvasBitmap = Bitmap . createBitmap ( width , height , Bitmap . Config . ARGB_8888 ) ; Canvas canvas = new Canvas ( canvasBitmap ) ; Paint paint = new Paint ( ) ; paint . setStyle... | Creates arrow icon that depends on ExpandDirection |
154,186 | private void startStripedAnimationIfNeeded ( ) { if ( ! striped || ! animated ) { return ; } clearAnimation ( ) ; progressAnimator = ValueAnimator . ofFloat ( 0 , 0 ) ; progressAnimator . setDuration ( UPDATE_ANIM_MS ) ; progressAnimator . setRepeatCount ( ValueAnimator . INFINITE ) ; progressAnimator . setRepeatMode (... | Starts an infinite animation cycle which provides the visual effect of stripes moving backwards . The current system time is used to offset tiled bitmaps of the progress background producing the effect that the stripes are moving backwards . |
154,187 | private static Bitmap createTile ( float h , Paint stripePaint , Paint progressPaint ) { Bitmap bm = Bitmap . createBitmap ( ( int ) h * 2 , ( int ) h , ARGB_8888 ) ; Canvas tile = new Canvas ( bm ) ; float x = 0 ; Path path = new Path ( ) ; path . moveTo ( x , 0 ) ; path . lineTo ( x , h ) ; path . lineTo ( h , h ) ; ... | Creates a Bitmap which is a tile of the progress bar background |
154,188 | public void setMaxProgress ( int newMaxProgress ) { if ( getProgress ( ) <= newMaxProgress ) { maxProgress = newMaxProgress ; } else { throw new IllegalArgumentException ( String . format ( "MaxProgress cant be smaller than the current progress %d<%d" , getProgress ( ) , newMaxProgress ) ) ; } invalidate ( ) ; Bootstra... | Used for settings the maxprogress . Also check if currentProgress is smaller than newMaxProgress . |
154,189 | protected Class < ? > [ ] getHandlerInterfaces ( String serviceName ) { Class < ? > remoteInterface = interfaceMap . get ( serviceName ) ; if ( remoteInterface != null ) { return new Class < ? > [ ] { remoteInterface } ; } else if ( Proxy . isProxyClass ( getHandler ( serviceName ) . getClass ( ) ) ) { return getHandle... | Returns the handler s class or interfaces . The serviceName is used to look up a registered handler . |
154,190 | protected String getServiceName ( final String methodName ) { if ( methodName != null ) { int ndx = methodName . indexOf ( this . separator ) ; if ( ndx > 0 ) { return methodName . substring ( 0 , ndx ) ; } } return methodName ; } | Get the service name from the methodNode . JSON - RPC methods with the form Service . method will result in Service being returned in this case . |
154,191 | public void handle ( ResourceRequest request , ResourceResponse response ) throws IOException { logger . debug ( "Handing ResourceRequest {}" , request . getMethod ( ) ) ; response . setContentType ( contentType ) ; InputStream input = getRequestStream ( request ) ; OutputStream output = response . getPortletOutputStre... | Handles a portlet request . |
154,192 | public void handle ( HttpServletRequest request , HttpServletResponse response ) throws IOException { logger . debug ( "Handling HttpServletRequest {}" , request ) ; response . setContentType ( contentType ) ; OutputStream output = response . getOutputStream ( ) ; InputStream input = getRequestStream ( request ) ; int ... | Handles a servlet request . |
154,193 | public void stop ( ) throws InterruptedException { if ( ! isStarted . get ( ) ) { throw new IllegalStateException ( "The StreamServer is not started" ) ; } stopServer ( ) ; stopClients ( ) ; closeSocket ( ) ; try { waitForServerToTerminate ( ) ; isStarted . set ( false ) ; stopServer ( ) ; } catch ( InterruptedExceptio... | Stops the server thread . |
154,194 | private void closeQuietly ( Closeable c ) { if ( c != null ) { try { c . close ( ) ; } catch ( Throwable t ) { logger . warn ( "Error closing, ignoring" , t ) ; } } } | Closes something quietly . |
154,195 | protected Class < ? > [ ] getHandlerInterfaces ( final String serviceName ) { if ( remoteInterface != null ) { return new Class < ? > [ ] { remoteInterface } ; } else if ( Proxy . isProxyClass ( handler . getClass ( ) ) ) { return handler . getClass ( ) . getInterfaces ( ) ; } else { return new Class < ? > [ ] { handle... | Returns the handler s class or interfaces . The variable serviceName is ignored in this class . |
154,196 | private ErrorObjectWithJsonError createResponseError ( String jsonRpc , Object id , JsonError errorObject ) { ObjectNode response = mapper . createObjectNode ( ) ; ObjectNode error = mapper . createObjectNode ( ) ; error . put ( ERROR_CODE , errorObject . code ) ; error . put ( ERROR_MESSAGE , errorObject . message ) ;... | Convenience method for creating an error response . |
154,197 | private ObjectNode createResponseSuccess ( String jsonRpc , Object id , JsonNode result ) { ObjectNode response = mapper . createObjectNode ( ) ; response . put ( JSONRPC , jsonRpc ) ; if ( Integer . class . isInstance ( id ) ) { response . put ( ID , Integer . class . cast ( id ) . intValue ( ) ) ; } else if ( Long . ... | Creates a success response . |
154,198 | private void initRestTemplate ( ) { boolean isContainsConverter = false ; for ( HttpMessageConverter < ? > httpMessageConverter : this . restTemplate . getMessageConverters ( ) ) { if ( MappingJacksonRPC2HttpMessageConverter . class . isAssignableFrom ( httpMessageConverter . getClass ( ) ) ) { isContainsConverter = tr... | Check RestTemplate contains required converters |
154,199 | private HttpURLConnection prepareConnection ( Map < String , String > extraHeaders ) throws IOException { HttpURLConnection connection = ( HttpURLConnection ) serviceUrl . openConnection ( connectionProxy ) ; connection . setConnectTimeout ( connectionTimeoutMillis ) ; connection . setReadTimeout ( readTimeoutMillis ) ... | Prepares a connection to the server . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.