idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
4,000 | static ResourceAddress getLowestTransportLayer ( ResourceAddress transport ) { if ( transport . getTransport ( ) != null ) { return getLowestTransportLayer ( transport . getTransport ( ) ) ; } return transport ; } | Method returning lowest transport layer |
4,001 | public void handleNotification ( Notification notification , Object handback ) { String notificationType = notification . getType ( ) ; if ( notificationType . equals ( JMXConnectionNotification . OPENED ) ) { managementContext . incrementManagementSessionCount ( ) ; } else if ( notificationType . equals ( JMXConnectio... | NotificationListener support for connection open and closed notifications |
4,002 | public HttpChallengeFactory lookup ( String authScheme ) { HttpChallengeFactory result ; if ( authScheme == null ) return null ; result = challengeFactoriesByAuthScheme . get ( authScheme ) ; if ( result == null ) { if ( authScheme . startsWith ( AUTH_SCHEME_APPLICATION_PREFIX ) ) { authScheme = authScheme . replaceFir... | public until unit test is moved |
4,003 | private static ByteBuffer putUnsignedLong ( ByteBuffer buffer , long v ) { buffer . putInt ( 0 ) ; return putUnsignedInt ( buffer , ( int ) v ) ; } | Puts an unsigned long . |
4,004 | protected void flushQueuedMessages ( IoSession session , AttachedSessionManager attachedSessionManager ) { Queue < Object > messageQueue = getMessageQueue ( session ) ; if ( messageQueue != null ) { flushQueuedMessages ( messageQueue , session , attachedSessionManager ) ; } } | called by connect listener in proxy service handler |
4,005 | public ChannelFuture joinGroup ( InetAddress multicastAddress , NetworkInterface networkInterface , InetAddress source ) { if ( DetectionUtil . javaVersion ( ) < 7 ) { throw new UnsupportedOperationException ( ) ; } if ( multicastAddress == null ) { throw new NullPointerException ( "multicastAddress" ) ; } if ( network... | Joins the specified multicast group at the specified interface using the specified source . |
4,006 | public ChannelFuture leaveGroup ( InetAddress multicastAddress , NetworkInterface networkInterface , InetAddress source ) { if ( DetectionUtil . javaVersion ( ) < 7 ) { throw new UnsupportedOperationException ( ) ; } else { if ( multicastAddress == null ) { throw new NullPointerException ( "multicastAddress" ) ; } if (... | Leave the specified multicast group at the specified interface using the specified source . |
4,007 | public ChannelFuture block ( InetAddress multicastAddress , InetAddress sourceToBlock ) { try { block ( multicastAddress , NetworkInterface . getByInetAddress ( getLocalAddress ( ) . getAddress ( ) ) , sourceToBlock ) ; } catch ( SocketException e ) { return failedFuture ( this , e ) ; } return succeededFuture ( this )... | Block the given sourceToBlock address for the given multicastAddress |
4,008 | private JSONArray getAlternativeNames ( Collection < List < ? > > alternativeNames ) { if ( alternativeNames == null || alternativeNames . size ( ) == 0 ) { return null ; } JSONArray altNames = new JSONArray ( ) ; for ( List < ? > altName : alternativeNames ) { String altNameValue = altName . get ( 1 ) . toString ( ) ;... | Given an AlternativeNames structure return a JSONArray with the name strings . |
4,009 | public void startupSessionTimeoutCommand ( ) { if ( initSessionTimeoutCommand . compareAndSet ( false , true ) ) { final Long sessionTimeout = getSessionTimeout ( ) ; if ( sessionTimeout != null && sessionTimeout > 0 ) { if ( scheduledEventslogger . isTraceEnabled ( ) ) { scheduledEventslogger . trace ( "Establishing a... | Start up timer for the session timeout of the WebSocket session |
4,010 | public void logout ( ) { if ( loginContext != null ) { try { loginContext . logout ( ) ; if ( logoutLogger . isDebugEnabled ( ) ) { logoutLogger . debug ( "[ws/#" + getId ( ) + "] Logout successful." ) ; } } catch ( LoginException e ) { logoutLogger . trace ( "[ws/#" + getId ( ) + "] Exception occurred logging out of t... | Log out of the login context associated with this WebSocket session . Used to clean up any login context state that should be cleaned up . |
4,011 | public static byte [ ] getOsVersion ( ) { String os = System . getProperty ( "os.name" ) ; if ( os == null || ! os . toUpperCase ( ) . contains ( "WINDOWS" ) ) { return DEFAULT_OS_VERSION ; } byte [ ] osVer = new byte [ 8 ] ; try { Process pr = Runtime . getRuntime ( ) . exec ( "cmd /C ver" ) ; BufferedReader reader = ... | Tries to return a valid OS version on Windows systems . If it fails to do so or if we re running on another OS then a fake Windows XP OS version is returned because the protocol uses it . |
4,012 | public static int writeSecurityBufferAndUpdatePointer ( ByteArrayOutputStream baos , short len , int pointer ) throws IOException { baos . write ( writeSecurityBuffer ( len , pointer ) ) ; return pointer + len ; } | Writes a security buffer and returns the pointer of the position where to write the next security buffer . |
4,013 | public static int extractFlagsFromType2Message ( byte [ ] msg ) { byte [ ] flagsBytes = new byte [ 4 ] ; System . arraycopy ( msg , 20 , flagsBytes , 0 , 4 ) ; ByteUtilities . changeWordEndianess ( flagsBytes , 0 , 4 ) ; return ByteUtilities . makeIntFromByte4 ( flagsBytes ) ; } | Extracts the NTLM flags from the type 2 message . |
4,014 | public static String extractTargetNameFromType2Message ( byte [ ] msg , Integer msgFlags ) throws UnsupportedEncodingException { byte [ ] targetName = readSecurityBufferTarget ( msg , 12 ) ; int flags = msgFlags == null ? extractFlagsFromType2Message ( msg ) : msgFlags ; if ( ByteUtilities . isFlagSet ( flags , FLAG_NE... | Extracts the target name from the type 2 message . |
4,015 | public static byte [ ] extractTargetInfoFromType2Message ( byte [ ] msg , Integer msgFlags ) { int flags = msgFlags == null ? extractFlagsFromType2Message ( msg ) : msgFlags ; if ( ! ByteUtilities . isFlagSet ( flags , FLAG_NEGOTIATE_TARGET_INFO ) ) return null ; int pos = 40 ; return readSecurityBufferTarget ( msg , p... | Extracts the target information block from the type 2 message . |
4,016 | private static void bind ( final NioDatagramChannel channel , final ChannelFuture future , final InetSocketAddress address ) { boolean bound = false ; boolean started = false ; try { channel . getDatagramChannel ( ) . socket ( ) . bind ( address ) ; bound = true ; future . setSuccess ( ) ; fireChannelBound ( channel , ... | Will bind the DatagramSocket to the passed - in address . Every call bind will spawn a new thread using the that basically in turn |
4,017 | public static IoBufferEx doEncode ( IoBufferAllocatorEx < ? > allocator , int flags , WsMessage message ) { IoBufferEx ioBuf = getBytes ( allocator , flags , message ) ; ByteBuffer buf = ioBuf . buf ( ) ; boolean mask = false ; boolean fin = message . isFin ( ) ; int maskValue = 0 ; int remaining = buf . remaining ( ) ... | Encode WebSocket message as a single frame |
4,018 | private List < PatternCacheControl > buildPatternsList ( ServiceProperties properties ) { Map < String , PatternCacheControl > patterns = new LinkedHashMap < > ( ) ; List < ServiceProperties > locationsList = properties . getNested ( "location" ) ; if ( locationsList != null && locationsList . size ( ) != 0 ) { for ( S... | Creates the list of PatternCacheControl objects |
4,019 | private void resolvePatternSpecificity ( Map < String , PatternCacheControl > patterns ) { List < String > patternList = new ArrayList < > ( ) ; patternList . addAll ( patterns . keySet ( ) ) ; int patternCount = patternList . size ( ) ; for ( int i = 0 ; i < patternCount - 1 ; i ++ ) { String specificPattern = pattern... | Matches the patterns from the map and determines each pattern s specificity |
4,020 | private void checkPatternMatching ( Map < String , PatternCacheControl > patterns , String specificPattern , String generalPattern ) { if ( PatternMatcherUtils . caseInsensitiveMatch ( specificPattern , generalPattern ) ) { PatternCacheControl specificPatternDirective = patterns . get ( specificPattern ) ; PatternCache... | Checks if the first pattern can be included in the second one and resolves directive conflicts if needed |
4,021 | private List < PatternCacheControl > sortByMatchingPatternCount ( Map < String , PatternCacheControl > unsortedMap ) { List < PatternCacheControl > list = new ArrayList < > ( unsortedMap . values ( ) ) ; Collections . sort ( list , PATTERN_CACHE_CONTROL_COMPARATOR ) ; return list ; } | Sorts the patterns map by the number of matching patterns and returns a list of sorted PatternCacheControl elements . The sorted list is used at request so that a file s URL can be matched to the most specific pattern . |
4,022 | private File toFile ( File rootDir , String location ) { File locationFile = rootDir ; if ( location != null ) { URI locationURI = URI . create ( location ) ; locationFile = new File ( locationURI . getPath ( ) ) ; if ( locationURI . getScheme ( ) == null ) { locationFile = new File ( rootDir , location ) ; } else if (... | Converts a location in the gateway configuration file into a file relative to a specified root directory . |
4,023 | public LoginContext createLoginContext ( Subject subject , final String username , final char [ ] password ) throws LoginException { final DefaultLoginResult loginResult = new DefaultLoginResult ( ) ; CallbackHandler handler = new CallbackHandler ( ) { public void handle ( Callback [ ] callbacks ) throws IOException , ... | For login context providers that can abstract their tokens into a username and password this is a utility method that can create the login context based on the provided username and password . |
4,024 | protected LoginContext createLoginContext ( Subject subject , CallbackHandler handler , DefaultLoginResult loginResult ) throws LoginException { return new ResultAwareLoginContext ( name , subject , handler , configuration , loginResult ) ; } | For login context providers that can abstract their tokens into a subject and a CallbackHandler that understands their token this is a utility method that can be called to construct a create login . |
4,025 | protected LoginContext createLoginContext ( CallbackHandler handler , final DefaultLoginResult loginResult ) throws LoginException { return createLoginContext ( null , handler , loginResult ) ; } | For login context providers that can abstract their tokens into a CallbackHandler that understands their token this is a utility method that can be called to construct a create login . |
4,026 | private void fireMemberAdded ( MemberId newMember ) { GL . debug ( GL . CLUSTER_LOGGER_NAME , "Firing member added for : {}" , newMember ) ; for ( MembershipEventListener listener : membershipEventListeners ) { try { listener . memberAdded ( newMember ) ; } catch ( Throwable e ) { GL . error ( GL . CLUSTER_LOGGER_NAME ... | Fire member added event |
4,027 | private void fireMemberRemoved ( MemberId exMember ) { GL . debug ( GL . CLUSTER_LOGGER_NAME , "Firing member removed for: {}" , exMember ) ; for ( MembershipEventListener listener : membershipEventListeners ) { try { listener . memberRemoved ( exMember ) ; } catch ( Throwable e ) { GL . error ( GL . CLUSTER_LOGGER_NAM... | Fire member removed event |
4,028 | public ChannelBuffer wrap ( ByteBuffer buffer ) { if ( buffer == null ) { throw new NullPointerException ( "buffer" ) ; } int position = buffer . position ( ) ; int limit = buffer . limit ( ) ; this . order = buffer . order ( ) ; this . buffer = buffer ; this . capacity = buffer . capacity ( ) ; setIndex ( position , l... | Creates a new buffer which wraps the specified buffer s slice . |
4,029 | private int toInt ( InetAddress inetAddress ) { byte [ ] address = inetAddress . getAddress ( ) ; int result = 0 ; for ( int i = 0 ; i < address . length ; i ++ ) { result <<= 8 ; result |= address [ i ] & BYTE_MASK ; } return result ; } | Converts an IP address into an integer |
4,030 | private Executor createDefaultExecutor ( int corePoolSize , int maximumPoolSize , long keepAliveTime , TimeUnit unit , ThreadFactory threadFactory , IoEventQueueHandler queueHandler ) { Executor executor = new OrderedThreadPoolExecutor ( corePoolSize , maximumPoolSize , keepAliveTime , unit , threadFactory , queueHandl... | Create an OrderedThreadPool executor . |
4,031 | private void initEventTypes ( IoEventType ... eventTypes ) { if ( ( eventTypes == null ) || ( eventTypes . length == 0 ) ) { eventTypes = DEFAULT_EVENT_SET ; } this . eventTypes = EnumSet . of ( eventTypes [ 0 ] , eventTypes ) ; if ( this . eventTypes . contains ( IoEventType . SESSION_CREATED ) ) { this . eventTypes =... | Create an EnumSet from an array of EventTypes and set the associated eventTypes field . |
4,032 | private void init ( Executor executor , boolean manageableExecutor , IoEventType ... eventTypes ) { if ( executor == null ) { throw new NullPointerException ( "executor" ) ; } initEventTypes ( eventTypes ) ; this . executor = executor ; this . manageableExecutor = manageableExecutor ; } | Creates a new instance of ExecutorFilter . This private constructor is called by all the public constructor . |
4,033 | public void putAll ( Map < ? extends K , ? extends V > newData ) { synchronized ( this ) { Map < K , V > newMap = new HashMap < > ( internalMap ) ; newMap . putAll ( newData ) ; internalMap = newMap ; } } | Inserts all the keys and values contained in the provided map to this map . |
4,034 | public void doSessionCreated ( SessionManagementBean sessionBean ) throws Exception { SessionMXBean sessionMxBean = managementServiceHandler . getSessionMXBean ( sessionBean . getId ( ) ) ; Map < String , String > userPrincipals = sessionBean . getUserPrincipalMap ( ) ; if ( userPrincipals != null ) { Map < String , Ma... | All of the following are expected to be OFF any session s IO thread . |
4,035 | public void doHandshake ( final NextFilter nextFilter ) throws ProxyAuthException { logger . debug ( " doHandshake()" ) ; if ( authHandler != null ) { authHandler . doHandshake ( nextFilter ) ; } else { if ( requestSent ) { throw new ProxyAuthException ( "Authentication request already sent" ) ; } logger . debug ( " s... | Performs the handshake processing . |
4,036 | public void handleResponse ( final HttpProxyResponse response ) throws ProxyAuthException { if ( ! isHandshakeComplete ( ) && ( "close" . equalsIgnoreCase ( StringUtilities . getSingleValuedHeader ( response . getHeaders ( ) , "Proxy-Connection" ) ) || "close" . equalsIgnoreCase ( StringUtilities . getSingleValuedHeade... | Handle a HTTP response from the proxy server . |
4,037 | public static String acceptHash ( String key ) { try { MessageDigest sha1 = MessageDigest . getInstance ( "SHA-1" ) ; sha1 . update ( key . getBytes ( UTF_8 ) ) ; sha1 . update ( WEBSOCKET_GUID ) ; byte [ ] hash = sha1 . digest ( ) ; byte [ ] output = Base64 . encodeBase64 ( hash ) ; return new String ( output ) ; } ca... | Compute the Sec - WebSocket - Accept header value as per RFC 6455 |
4,038 | protected boolean isConnectionOk ( IoSession session ) { SocketAddress remoteAddress = session . getRemoteAddress ( ) ; if ( remoteAddress instanceof InetSocketAddress ) { InetSocketAddress addr = ( InetSocketAddress ) remoteAddress ; long now = System . currentTimeMillis ( ) ; if ( clients . containsKey ( addr . getAd... | Method responsible for deciding if a connection is OK to continue |
4,039 | public static int getNextAvailable ( int fromPort ) { if ( fromPort < MIN_PORT_NUMBER || fromPort > MAX_PORT_NUMBER ) { throw new IllegalArgumentException ( "Invalid start port: " + fromPort ) ; } for ( int i = fromPort ; i <= MAX_PORT_NUMBER ; i ++ ) { if ( available ( i ) ) { return i ; } } throw new NoSuchElementExc... | Gets the next available port starting at a port . |
4,040 | public static boolean available ( int port ) { if ( port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER ) { throw new IllegalArgumentException ( "Invalid start port: " + port ) ; } ServerSocket ss = null ; DatagramSocket ds = null ; try { ss = new ServerSocket ( port ) ; ss . setReuseAddress ( true ) ; ds = new DatagramSo... | Checks to see if a specific port is available . |
4,041 | public static String getHost ( String uriString ) { try { URI uri = new URI ( uriString ) ; if ( uri . getHost ( ) == null ) { throw new IllegalArgumentException ( "Invalid URI syntax. Scheme and host must be provided (port number is optional): " + uriString ) ; } if ( uri . getAuthority ( ) . startsWith ( "@" ) && ! u... | Helper method for retrieving host |
4,042 | public static String getScheme ( String uriString ) { try { return ( new URI ( uriString ) ) . getScheme ( ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriString ) ) . getScheme ( ) ; } catch ( IllegalArgumentException ne ) { throw new IllegalArgumentException ( ne . getMessage ( ) , ... | Helper method for retrieving scheme |
4,043 | public static int getPort ( String uriString ) { try { return ( new URI ( uriString ) ) . getPort ( ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriString ) ) . getPort ( ) ; } catch ( IllegalArgumentException ne ) { throw new IllegalArgumentException ( ne . getMessage ( ) , ne ) ; } ... | Helper method for retrieving port |
4,044 | public static String resolve ( String uriInitial , String uriString ) { try { return uriToString ( ( new URI ( uriInitial ) ) . resolve ( uriString ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriInitial ) ) . resolve ( uriString ) ; } catch ( IllegalArgumentException ne ) { throw n... | Helper method for performing resolve as String |
4,045 | public static String modifyURIScheme ( String uri , String newScheme ) { try { URI uriObj = new URI ( uri ) ; return uriToString ( URLUtils . modifyURIScheme ( uriObj , newScheme ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uri ) ) . modifyURIScheme ( newScheme ) ; } catch ( Illegal... | Helper method for modifying URI scheme |
4,046 | public static String modifyURIAuthority ( String uri , String newAuthority ) { try { URI uriObj = new URI ( uri ) ; Pattern pattern = Pattern . compile ( NETWORK_INTERFACE_AUTHORITY ) ; Matcher matcher = pattern . matcher ( newAuthority ) ; String matchedToken = MOCK_HOST ; if ( matcher . find ( ) ) { matchedToken = ma... | Helper method for modifying URI authority |
4,047 | public static String modifyURIPort ( String uri , int newPort ) { try { URI uriObj = new URI ( uri ) ; return uriToString ( URLUtils . modifyURIPort ( uriObj , newPort ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uri ) ) . modifyURIPort ( newPort ) ; } catch ( IllegalArgumentExcepti... | Helper method for modifying URI port |
4,048 | public static String modifyURIPath ( String uri , String newPath ) { try { URI uriObj = new URI ( uri ) ; return uriToString ( URLUtils . modifyURIPath ( uriObj , newPath ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uri ) ) . modifyURIPath ( newPath ) ; } catch ( IllegalArgumentExce... | Helper method for modiffying the URI path |
4,049 | private String getCertCN ( X509Certificate x509 ) throws CertificateParsingException { X500Principal principal = x509 . getSubjectX500Principal ( ) ; String subjectName = principal . getName ( ) ; String [ ] fields = subjectName . split ( "," ) ; for ( String field : fields ) { if ( field . startsWith ( "CN=" ) ) { Str... | Read the CN out of the cert |
4,050 | private Collection < String > getCertServerNames ( X509Certificate x509 ) throws CertificateParsingException { Collection < String > serverNames = new LinkedHashSet < > ( ) ; String certCN = getCertCN ( x509 ) ; serverNames . add ( certCN ) ; try { Collection < List < ? > > altNames = x509 . getSubjectAlternativeNames ... | Build up the list of server names represented by a certificate |
4,051 | public static BitSet decodeBitString ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_BIT_STRING_TAG_NUM ) && ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . CONSTRUCTED , ASN1_BIT_STRING_TAG_NUM ... | Decode an ASN . 1 BIT STRING . |
4,052 | public static Date decodeGeneralizedTime ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_GENERALIZED_TIME_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected GeneralizedTime identifier, received " + id ) ; } i... | Decode an ASN . 1 GeneralizedTime . |
4,053 | public static String decodeIA5String ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_IA5STRING_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected IA5String identifier, received " + id ) ; } int len = DerUtils... | Decode an ASN . 1 IA5String . |
4,054 | public static int decodeInteger ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_INTEGER_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected INTEGER identifier, received " + id ) ; } int len = DerUtils . decode... | Decode an ASN . 1 INTEGER . |
4,055 | public static short [ ] decodeOctetString ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , ASN1_OCTET_STRING_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected OCTET STRING identifier, received " + id ) ; } int len = DerUtils . decodeLength ( buf ) ... | Decode an ASN . 1 OCTET STRING . |
4,056 | public static int decodeSequence ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . CONSTRUCTED , ASN1_SEQUENCE_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected SEQUENCE identifier, received " + id ) ; } int len = DerUtils . d... | Decode an ASN . 1 SEQUENCE by reading the identifier and length octets . The remaining data in the buffer is the SEQUENCE . |
4,057 | public static int encodeBitString ( BitSet value , int nbits , ByteBuffer buf ) { if ( value == null || nbits < value . length ( ) ) { throw new IllegalArgumentException ( ) ; } int pos = buf . position ( ) ; int contentLength = ( int ) Math . ceil ( nbits / 8.0d ) ; for ( int i = contentLength ; i > 0 ; i -- ) { byte ... | Encode an ASN . 1 BIT STRING . |
4,058 | public static int encodeGeneralizedTime ( Date date , ByteBuffer buf ) { if ( date == null ) { throw new IllegalArgumentException ( ) ; } int pos = buf . position ( ) ; SimpleDateFormat format = new SimpleDateFormat ( GENERALIZED_TIME_FORMAT ) ; format . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; String value =... | Encode an ASN . 1 GeneralizedTime . |
4,059 | public static int encodeIA5String ( String value , ByteBuffer buf ) { int pos = buf . position ( ) ; byte [ ] data = ( value == null ) ? new byte [ 0 ] : value . getBytes ( ) ; for ( int i = data . length - 1 ; i >= 0 ; i -- ) { pos -- ; buf . put ( pos , data [ i ] ) ; } buf . position ( buf . position ( ) - data . le... | Encode an ASN . 1 IA5String . |
4,060 | public static int encodeInteger ( int value , ByteBuffer buf ) { int pos = buf . position ( ) ; int contentLength = 0 ; do { pos -- ; buf . put ( pos , ( byte ) ( value & 0xff ) ) ; value >>>= 8 ; contentLength ++ ; } while ( value != 0 ) ; buf . position ( buf . position ( ) - contentLength ) ; int headerLen = DerUtil... | Encode an ASN . 1 INTEGER . |
4,061 | public static int encodeOctetString ( short [ ] octets , ByteBuffer buf ) { if ( octets == null ) { octets = new short [ 0 ] ; } int pos = buf . position ( ) ; for ( int i = octets . length - 1 ; i >= 0 ; i -- ) { pos -- ; buf . put ( pos , ( byte ) octets [ i ] ) ; } buf . position ( buf . position ( ) - octets . leng... | Encode an ASN . 1 OCTET STRING . |
4,062 | public static int encodeSequence ( int contentLength , ByteBuffer buf ) { int headerLength = DerUtils . encodeIdAndLength ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . CONSTRUCTED , ASN1_SEQUENCE_TAG_NUM , contentLength , buf ) ; return headerLength + contentLength ; } | Encode an ASN . 1 SEQUENCE . |
4,063 | public static int sizeOfBitString ( BitSet value , int nbits ) { return DerUtils . sizeOf ( ASN1_BIT_STRING_TAG_NUM , ( int ) Math . ceil ( nbits / 8.0d ) + 1 ) ; } | Size of an ASN . 1 BIT STRING . |
4,064 | public static int sizeOfIA5String ( String value ) { return DerUtils . sizeOf ( ASN1_IA5STRING_TAG_NUM , ( value == null ) ? 0 : value . getBytes ( ) . length ) ; } | Size of an ASN . 1 IA5String . |
4,065 | public static int sizeOfInteger ( int value ) { int contentLength = 0 ; do { value >>>= 8 ; contentLength ++ ; } while ( value != 0 ) ; return DerUtils . sizeOf ( ASN1_INTEGER_TAG_NUM , contentLength ) ; } | Size of an ASN . 1 INTEGER . |
4,066 | private byte [ ] pad ( ) { int pos = ( int ) ( msgLength % BYTE_BLOCK_LENGTH ) ; int padLength = ( pos < 56 ) ? ( 64 - pos ) : ( 128 - pos ) ; byte [ ] pad = new byte [ padLength ] ; pad [ 0 ] = ( byte ) 0x80 ; long bits = msgLength << 3 ; int index = padLength - 8 ; for ( int i = 0 ; i < 8 ; i ++ ) { pad [ index ++ ] ... | Pads the buffer by appending the byte 0x80 then append as many zero bytes as necessary to make the buffer length a multiple of 64 bytes . The last 8 bytes will be filled with the length of the buffer in bits . If there s no room to store the length in bits in the block i . e the block is larger than 56 bytes then an ad... |
4,067 | private static synchronized ProductInfo generateProductInfo ( ) { ProductInfo result = new ProductInfo ( ) ; boolean foundJar = false ; String [ ] pathEntries = System . getProperty ( "java.class.path" ) . split ( System . getProperty ( "path.separator" ) ) ; Map < String , Attributes > products = new TreeMap < > ( Col... | Find the product information from the server JAR MANIFEST files and store it in static variables here for later retrieval . |
4,068 | public AmqpTable addInteger ( String key , int value ) { this . add ( key , value , AmqpType . INT ) ; return this ; } | Adds an integer entry to the AmqpTable . |
4,069 | public AmqpTable addLongString ( String key , String value ) { this . add ( key , value , AmqpType . LONGSTRING ) ; return this ; } | Adds a long string entry to the AmqpTable . |
4,070 | private SessionTasksQueue getSessionTasksQueue ( IoSession session ) { SessionTasksQueue queue = ( SessionTasksQueue ) session . getAttribute ( TASKS_QUEUE ) ; if ( queue == null ) { queue = new SessionTasksQueue ( ) ; SessionTasksQueue oldQueue = ( SessionTasksQueue ) session . setAttributeIfAbsent ( TASKS_QUEUE , que... | Get the session s tasks queue . |
4,071 | private void print ( Queue < Runnable > queue , IoEvent event ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Adding event " ) . append ( event . getType ( ) ) . append ( " to session " ) . append ( event . getSession ( ) . getId ( ) ) ; boolean first = true ; sb . append ( "\nQueue : [" ) ; for ( Runnabl... | A Helper class used to print the list of events being queued . |
4,072 | public static String createAuthorization ( final String username , final String password ) { return new String ( Base64 . encodeBase64 ( ( username + ":" + password ) . getBytes ( ) ) ) ; } | Computes the authorization header value . |
4,073 | public final void add ( final T session ) { if ( session . isIoAligned ( ) ) { verifyInIoThread ( session , session . getIoThread ( ) ) ; } add0 ( session ) ; } | until the processor is created and started |
4,074 | static SmushingRulesToApply getRulesToApply ( Integer oldLayout , Integer fullLayout ) { List < SmushingRule > horizontalSmushingRules = new ArrayList < SmushingRule > ( ) ; List < SmushingRule > verticalSmushingRules = new ArrayList < SmushingRule > ( ) ; SmushingRule . Layout horizontalLayout = null ; SmushingRule . ... | Return definition of smushing logic to be applied . |
4,075 | @ SuppressWarnings ( "StatementWithEmptyBody" ) private static int calculateOverlay ( FigletFont figletFont , char [ ] [ ] char1 , char [ ] [ ] char2 ) { if ( figletFont . smushingRulesToApply . getHorizontalLayout ( ) == SmushingRule . Layout . FULL_WIDTH ) { return 0 ; } int maxPotentialOverlay = figletFont . maxLine... | Workouts the amount of characters that can be smushed across all lines . |
4,076 | public String getCharLineString ( int c , int l ) { if ( font [ c ] [ l ] == null ) return null ; else { return new String ( font [ c ] [ l ] ) . replace ( hardblank , ' ' ) ; } } | Selects a single line from a character . |
4,077 | public void close ( ) throws IOException { if ( session != null && session . isConnected ( ) ) { session . disconnect ( ) ; } session = null ; for ( Tunnel tunnel : tunnels ) { tunnel . setAssignedLocalPort ( 0 ) ; } } | Closes the underlying ssh session causing all tunnels to be closed . |
4,078 | public void open ( ) throws JSchException { if ( isOpen ( ) ) { return ; } session = sessionFactory . newSession ( ) ; logger . debug ( "connecting session" ) ; session . connect ( ) ; for ( Tunnel tunnel : tunnels ) { int assignedPort = 0 ; if ( tunnel . getLocalAlias ( ) == null ) { assignedPort = session . setPortFo... | Opens a session and connects all of the tunnels . |
4,079 | public Session getSession ( ) throws JSchException { if ( session == null || ! session . isConnected ( ) ) { logger . debug ( "getting new session from factory session" ) ; session = sessionFactory . newSession ( ) ; logger . debug ( "connecting session" ) ; session . connect ( ) ; } return session ; } | Returns a connected session . |
4,080 | private static InputStreamReader decompressWith7Zip ( final String archivePath ) throws ConfigurationException { PATH_PROGRAM_7ZIP = ( String ) config . getConfigParameter ( ConfigurationKeys . PATH_PROGRAM_7ZIP ) ; if ( PATH_PROGRAM_7ZIP == null ) { throw ErrorFactory . createConfigurationException ( ErrorKeys . CONFI... | Starts a decompression process using the 7Zip program . |
4,081 | private static InputStreamReader decompressWithBZip2 ( final String archivePath ) throws ConfigurationException { Bzip2Archiver archiver = new Bzip2Archiver ( ) ; InputStreamReader reader = null ; try { reader = archiver . getDecompressionStream ( archivePath , WIKIPEDIA_ENCODING ) ; } catch ( IOException e ) { e . pri... | Starts a decompression process using the BZip2 program . |
4,082 | private static InputStreamReader readXMLFile ( final String archivePath ) { try { return new InputStreamReader ( new BufferedInputStream ( new FileInputStream ( archivePath ) ) , WIKIPEDIA_ENCODING ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | Creates a reader for the xml file . |
4,083 | public static ArticleReaderInterface getTaskReader ( final ArchiveDescription archive ) throws ConfigurationException , ArticleReaderException { Reader reader = null ; switch ( archive . getType ( ) ) { case XML : reader = readXMLFile ( archive . getPath ( ) ) ; break ; case SEVENZIP : reader = decompressWith7Zip ( arc... | Returns an ArticleReader which reads the specified input file . |
4,084 | private void createSystemMenu ( ) { JMenu system = new JMenu ( "System" ) ; JMenuItem importConfig = new JMenuItem ( "Import Configuration" ) ; importConfig . addActionListener ( new ActionListener ( ) { public void actionPerformed ( final ActionEvent e ) { controller . loadConfiguration ( ) ; } } ) ; system . add ( im... | Creates the System menu and its menu items . |
4,085 | public void setConfigParameter ( final ConfigurationKeys key , Object value ) { if ( key == ConfigurationKeys . LOGGING_PATH_DEBUG || key == ConfigurationKeys . LOGGING_PATH_DIFFTOOL || key == ConfigurationKeys . PATH_OUTPUT_SQL_FILES ) { String v = ( String ) value ; if ( ! v . endsWith ( File . separator ) && v . con... | Assigns the given value to the the given key . |
4,086 | public Object getConfigParameter ( final ConfigurationKeys configParameter ) { if ( this . parameterMap . containsKey ( configParameter ) ) { return this . parameterMap . get ( configParameter ) ; } return null ; } | Returns the value related to the configuration key or null if the key is not contained . |
4,087 | public void defaultConfiguration ( ) { clear ( ) ; setConfigParameter ( ConfigurationKeys . VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING , 12 ) ; setConfigParameter ( ConfigurationKeys . COUNTER_FULL_REVISION , 1000 ) ; setConfigParameter ( ConfigurationKeys . LIMIT_TASK_SIZE_REVISIONS , 5000000l ) ; setConfigParameter ( Con... | Applies the default single thread configuration of the DiffTool to this settings . |
4,088 | public void loadConfig ( final String path ) { try { ConfigurationReader reader = new ConfigurationReader ( path ) ; ConfigSettings settings = reader . read ( ) ; clear ( ) ; this . type = settings . type ; this . parameterMap = settings . parameterMap ; this . archives = settings . archives ; } catch ( Exception e ) {... | Loads the configuration settings from a file . |
4,089 | public static ConfigurationException createConfigurationException ( final ErrorKeys errorId , final String message ) { return new ConfigurationException ( errorId . toString ( ) + ":\r\n" + message ) ; } | Creates a ConfigurationException object . |
4,090 | public static LoggingException createLoggingException ( final ErrorKeys errorId , final Exception e ) { return new LoggingException ( errorId . toString ( ) , e ) ; } | Creates a LoggingException object . |
4,091 | public ConfigSettings read ( ) { ConfigSettings config = new ConfigSettings ( ConfigEnum . IMPORT ) ; String name ; Node node ; NodeList list = root . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { node = list . item ( i ) ; name = node . getNodeName ( ) . toUpperCase ( ... | Reads the input of the configuration file and parses the into the ConfigSettings object . |
4,092 | private void parseFilterConfig ( final Node node , final ConfigSettings config ) { String name ; Node nnode ; final NodeList list = node . getChildNodes ( ) ; final int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; ... | Parses the filter parameter section . |
4,093 | private void parseNamespaceFilterConfig ( final Node node , final ConfigSettings config ) { String name ; Integer value ; Node nnode ; final NodeList list = node . getChildNodes ( ) ; final int length = list . getLength ( ) ; final Set < Integer > namespaces = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < length ... | Parses the namespaces parameter section . This is the subsection of filter . |
4,094 | private void parseModeConfig ( final Node node , final ConfigSettings config ) { String name ; Integer value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ... | Parses the mode parameter section . |
4,095 | private void parseExternalsConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; i... | Parses the externals parameter section . |
4,096 | private void parseInputConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; if ( ... | Parses the input parameter section . |
4,097 | private void parseInputArchive ( final Node node , final ConfigSettings config ) { String name ; InputType type = null ; String path = null ; long startPosition = 0 ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item (... | Parses the input archive subsection . |
4,098 | private void parseOutputConfig ( final Node node , final ConfigSettings config ) { String name ; Long lValue ; Boolean bValue ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) .... | Parses the output parameter section . |
4,099 | private void parseSQLConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; if ( na... | Parses the sql parameter section . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.