idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
127,000 | private void renderClass ( ClassDoc doc , DocletRenderer renderer ) { renderer . renderDoc ( doc ) ; for ( MemberDoc member : doc . fields ( ) ) { renderer . renderDoc ( member ) ; } for ( MemberDoc member : doc . constructors ( ) ) { renderer . renderDoc ( member ) ; } for ( MemberDoc member : doc . methods ( ) ) { re... | Renders an individual class . |
127,001 | public void close ( ) throws IOException , GeneralSecurityException { if ( mManifest != null ) { mOutputJar . putNextEntry ( new JarEntry ( JarFile . MANIFEST_NAME ) ) ; mManifest . write ( mOutputJar ) ; Signature signature = Signature . getInstance ( "SHA1with" + mKey . getAlgorithm ( ) ) ; signature . initSign ( mKe... | Closes the Jar archive by creating the manifest and signing the archive . |
127,002 | private void writeSignatureBlock ( Signature signature , X509Certificate publicKey , PrivateKey privateKey ) throws IOException , GeneralSecurityException { SignerInfo signerInfo = new SignerInfo ( new X500Name ( publicKey . getIssuerX500Principal ( ) . getName ( ) ) , publicKey . getSerialNumber ( ) , AlgorithmId . ge... | Write the certificate file with a digital signature . |
127,003 | public void validate ( ) { Revision revBuildToolsVersion = Revision . parseRevision ( buildToolsVersion ) ; if ( minimalBuildToolsVersion . compareTo ( revBuildToolsVersion ) > 0 ) { throw new GradleException ( "Android buildToolsVersion should be at least version " + minimalBuildToolsVersion + ": currently using " + b... | Checks whether the properties on the android extension are valid after everything was configured . |
127,004 | public static SigningInfo getDebugKey ( String storeOsPath , final PrintStream verboseStream ) throws ApkCreationException { try { if ( storeOsPath != null ) { File storeFile = new File ( storeOsPath ) ; try { checkInputFile ( storeFile ) ; } catch ( FileNotFoundException e ) { } if ( verboseStream != null ) { verboseS... | Returns the key and certificate from a given debug store . |
127,005 | private void init ( File apkFile , File resFile , File dexFile , PrivateKey key , X509Certificate certificate , PrintStream verboseStream ) throws ApkCreationException { try { checkOutputFile ( mApkFile = apkFile ) ; checkInputFile ( mResFile = resFile ) ; if ( dexFile != null ) { checkInputFile ( mDexFile = dexFile ) ... | Constructor init method . |
127,006 | public void addFile ( File file , String archivePath ) throws ApkCreationException , SealedApkException , DuplicateFileException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } try { doAddFile ( file , archivePath ) ; } catch ( DuplicateFileException e ) { mBuilder . cleanUp ( ) ; thro... | Adds a file to the APK at a given path |
127,007 | public void addZipFile ( File zipFile ) throws ApkCreationException , SealedApkException , DuplicateFileException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } try { verbosePrintln ( "%s:" , zipFile ) ; mNullFilter . reset ( zipFile ) ; FileInputStream fis = new FileInputStream ( zip... | Adds the content from a zip file . All file keep the same path inside the archive . |
127,008 | public JarStatus addResourcesFromJar ( File jarFile ) throws ApkCreationException , SealedApkException , DuplicateFileException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } try { verbosePrintln ( "%s:" , jarFile ) ; mFilter . reset ( jarFile ) ; FileInputStream fis = new FileInputSt... | Adds the resources from a jar file . |
127,009 | public void addSourceFolder ( File sourceFolder ) throws ApkCreationException , SealedApkException , DuplicateFileException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } addSourceFolder ( this , sourceFolder ) ; } | Adds the resources from a source folder . |
127,010 | public void addNativeLibraries ( File nativeFolder ) throws ApkCreationException , SealedApkException , DuplicateFileException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } if ( ! nativeFolder . isDirectory ( ) ) { if ( nativeFolder . exists ( ) ) { throw new ApkCreationException ( "... | Adds the native libraries from the top native folder . The content of this folder must be the various ABI folders . |
127,011 | public void sealApk ( ) throws ApkCreationException , SealedApkException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } try { mBuilder . close ( ) ; mIsSealed = true ; } catch ( Exception e ) { throw new ApkCreationException ( e , "Failed to seal APK" ) ; } finally { mBuilder . cleanU... | Seals the APK and signs it if necessary . |
127,012 | private void verbosePrintln ( String format , Object ... args ) { if ( mVerboseStream != null ) { mVerboseStream . println ( String . format ( format , args ) ) ; } } | Output a given message if the verbose mode is enabled . |
127,013 | public static boolean checkFolderForPackaging ( String folderName ) { return ! folderName . equalsIgnoreCase ( "CVS" ) && ! folderName . equalsIgnoreCase ( ".svn" ) && ! folderName . equalsIgnoreCase ( "SCCS" ) && ! folderName . startsWith ( "_" ) ; } | Checks whether a folder and its content is valid for packaging into the . apk as standard Java resource . |
127,014 | public void applyConfiguration ( Configuration configuration ) { if ( plugins != null ) { plugins . stream ( ) . filter ( pluginDefinition -> pluginDefinition . isConfigurationSupported ( configuration ) ) . forEach ( pluginDefinition -> project . getDependencies ( ) . add ( configuration . getName ( ) , generateDepend... | Add dependencies to the specified configuration . Only dependencies to plugins that support the provided configuration will be included . |
127,015 | List < ResourceSet > computeResourceSetList ( ) { List < ResourceSet > sourceFolderSets = resSetSupplier . get ( ) ; int size = sourceFolderSets . size ( ) + 4 ; if ( libraries != null ) { size += libraries . getArtifacts ( ) . size ( ) ; } List < ResourceSet > resourceSetList = Lists . newArrayListWithExpectedSize ( s... | Compute the list of resource set to be used during execution based all the inputs . |
127,016 | private static void examineAsBrowser ( final UserAgent . Builder builder , final Data data ) { Matcher matcher ; VersionNumber version = VersionNumber . UNKNOWN ; for ( final Entry < BrowserPattern , Browser > entry : data . getPatternToBrowserMap ( ) . entrySet ( ) ) { matcher = entry . getKey ( ) . getPattern ( ) . m... | Examines the user agent string whether it is a browser . |
127,017 | private static boolean examineAsRobot ( final UserAgent . Builder builder , final Data data ) { boolean isRobot = false ; VersionNumber version ; for ( final Robot robot : data . getRobots ( ) ) { if ( robot . getUserAgentString ( ) . equals ( builder . getUserAgentString ( ) ) ) { isRobot = true ; robot . copyTo ( bui... | Examines the user agent string whether it is a robot . |
127,018 | private static void examineDeviceCategory ( final UserAgent . Builder builder , final Data data ) { if ( UserAgentType . ROBOT == builder . getType ( ) ) { final DeviceCategory category = findDeviceCategoryByValue ( Category . OTHER , data ) ; builder . setDeviceCategory ( category ) ; return ; } for ( final Entry < De... | Examines the user agent string whether has a specific device category . |
127,019 | private static void examineOperatingSystem ( final UserAgent . Builder builder , final Data data ) { if ( net . sf . uadetector . OperatingSystem . EMPTY . equals ( builder . getOperatingSystem ( ) ) ) { for ( final Entry < OperatingSystemPattern , OperatingSystem > entry : data . getPatternToOperatingSystemMap ( ) . e... | Examines the operating system of the user agent string if not available . |
127,020 | public int compare ( final T o1 , final T o2 ) { int result = 0 ; if ( o1 == null ) { if ( o2 != null ) { result = - 1 ; } } else if ( o2 == null ) { result = 1 ; } else { result = compareType ( o1 , o2 ) ; } return result ; } | Compares two objects null safe to each other . |
127,021 | private static int compareInt ( final int a , final int b ) { int result = 0 ; if ( a > b ) { result = 1 ; } else if ( a < b ) { result = - 1 ; } return result ; } | Compares to integers . |
127,022 | static boolean hasUpdate ( final String newer , final String older ) { return VERSION_PATTERN . matcher ( newer ) . matches ( ) && VERSION_PATTERN . matcher ( older ) . matches ( ) ? newer . compareTo ( older ) > 0 : false ; } | Checks a given newer version against an older one . |
127,023 | protected boolean isUpdateAvailable ( ) { boolean result = false ; String version = EMPTY_VERSION ; try { version = retrieveRemoteVersion ( store . getVersionUrl ( ) , store . getCharset ( ) ) ; } catch ( final IOException e ) { LOG . info ( MSG_NO_UPDATE_CHECK_POSSIBLE ) ; LOG . debug ( String . format ( MSG_NO_UPDATE... | Fetches the current version information over HTTP and compares it with the last version of the most recently imported data . |
127,024 | public DataBuilder appendBrowserPattern ( final BrowserPattern pattern ) { Check . notNull ( pattern , "pattern" ) ; if ( ! browserPatterns . containsKey ( pattern . getId ( ) ) ) { browserPatterns . put ( pattern . getId ( ) , new TreeSet < BrowserPattern > ( BROWSER_PATTERN_COMPARATOR ) ) ; } browserPatterns . get ( ... | Appends a browser pattern to the map of pattern sorted by ID . |
127,025 | public DataBuilder appendDevicePattern ( final DevicePattern pattern ) { Check . notNull ( pattern , "pattern" ) ; if ( ! devicePatterns . containsKey ( pattern . getId ( ) ) ) { devicePatterns . put ( pattern . getId ( ) , new TreeSet < DevicePattern > ( DEVICE_PATTERN_COMPARATOR ) ) ; } devicePatterns . get ( pattern... | Appends a device pattern to the map of pattern sorted by ID . |
127,026 | public DataBuilder appendOperatingSystemPattern ( final OperatingSystemPattern pattern ) { Check . notNull ( pattern , "pattern" ) ; if ( ! operatingSystemPatterns . containsKey ( pattern . getId ( ) ) ) { operatingSystemPatterns . put ( pattern . getId ( ) , new TreeSet < OperatingSystemPattern > ( OS_PATTERN_COMPARAT... | Appends an operating system pattern to the map of pattern sorted by ID . |
127,027 | private void setUpUpdateService ( ) { if ( currentUpdateTask != null ) { currentUpdateTask . cancel ( false ) ; } currentUpdateTask = scheduler . scheduleWithFixedDelay ( getDataStore ( ) . getUpdateOperation ( ) , 0 , updateInterval , MILLISECONDS ) ; } | Set up a new update service to get newer UAS data |
127,028 | public void copyTo ( final UserAgent . Builder builder ) { final OperatingSystemFamily f = OperatingSystemFamily . evaluate ( family ) ; final VersionNumber version = VersionNumber . parseOperatingSystemVersion ( f , builder . getUserAgentString ( ) ) ; builder . setOperatingSystem ( new net . sf . uadetector . Operati... | Copies all information of the current operating system entry to the given user agent builder . |
127,029 | protected static File createTemporaryFile ( final File file ) { Check . notNull ( file , "file" ) ; final File tempFile = new File ( file . getParent ( ) , file . getName ( ) + ".temp" ) ; deleteFile ( tempFile ) ; return tempFile ; } | Creates a temporary file near the passed file . The name of the given one will be used and the suffix . temp will be added . |
127,030 | protected static void deleteFile ( final File file ) { Check . notNull ( file , "file" ) ; Check . stateIsTrue ( ! file . exists ( ) || file . delete ( ) , "Cannot delete file '%s'." , file . getPath ( ) ) ; } | Removes the given file . |
127,031 | private static String toVersionString ( final List < String > groups ) { final StringBuilder builder = new StringBuilder ( 6 ) ; int count = 0 ; for ( final String segment : groups ) { if ( EMPTY_GROUP . equals ( segment ) ) { break ; } else { if ( count > 0 ) { builder . append ( SEPARATOR ) ; } builder . append ( seg... | Converts the given list of numbers in a version string . The groups of the version number will be separated by a dot . |
127,032 | public int compareTo ( final ReadableVersionNumber other ) { int result = 0 ; if ( other == null ) { result = - 1 ; } else { Check . notNull ( other . getGroups ( ) , "other.getGroups()" ) ; final int length = groups . size ( ) < other . getGroups ( ) . size ( ) ? groups . size ( ) : other . getGroups ( ) . size ( ) ; ... | Compares this version number with the specified version number for order . Returns a negative integer zero or a positive integer as this version number is less than equal to or greater than the specified version number . |
127,033 | protected static void logParsingIssue ( final String prefix , final SAXParseException e ) { final StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( prefix ) ; buffer . append ( " while reading UAS data: " ) ; buffer . append ( e . getMessage ( ) ) ; buffer . append ( " (line: " ) ; buffer . append ( e . ... | Logs an issue while parsing XML . |
127,034 | private void transferToSpecificBuilderAndReset ( ) { if ( currentTag == Tag . VERSION ) { dataBuilder . setVersion ( buffer . toString ( ) ) ; } addToRobotBuilder ( ) ; addToBrowserBuilder ( ) ; addToOperatingSystemBuilder ( ) ; addToBrowserPatternBuilder ( ) ; addToBrowserTypeBuilder ( ) ; addToBrowserOsMappingBuilder... | Transfers all characters of a specific tag to the corresponding builder and resets the string buffer . |
127,035 | private static void deleteCacheFile ( final File cacheFile ) { try { if ( cacheFile . delete ( ) ) { LOG . warn ( String . format ( MSG_CACHE_FILE_IS_DAMAGED_AND_DELETED , cacheFile . getPath ( ) ) ) ; } else { LOG . warn ( String . format ( MSG_CACHE_FILE_IS_DAMAGED , cacheFile . getPath ( ) ) ) ; } } catch ( final Ex... | Removes the given cache file because it contains damaged content . |
127,036 | private static DataStore readCacheFileAsFallback ( final DataReader reader , final File cacheFile , final Charset charset , final DataStore fallback ) { DataStore fallbackDataStore ; if ( ! isEmpty ( cacheFile , charset ) ) { final URL cacheFileUrl = UrlUtil . toUrl ( cacheFile ) ; try { fallbackDataStore = new CacheFi... | Tries to read the content of specified cache file and returns them as fallback data store . If the cache file contains unexpected data the given fallback data store will be returned instead . |
127,037 | public void activate ( InetAddress host , int port , Collection < String > nonProxyHosts ) { for ( String scheme : new String [ ] { "http" , "https" } ) { String currentProxyHost = System . getProperty ( scheme + ".proxyHost" ) ; String currentProxyPort = System . getProperty ( scheme + ".proxyPort" ) ; if ( currentPro... | Activates a proxy override for the given URI scheme . |
127,038 | public void deactivateAll ( ) { for ( String scheme : new String [ ] { "http" , "https" } ) { InetSocketAddress originalProxy = originalProxies . remove ( scheme ) ; if ( originalProxy != null ) { System . setProperty ( scheme + ".proxyHost" , originalProxy . getHostName ( ) ) ; System . setProperty ( scheme + ".proxyP... | Deactivates all proxy overrides restoring the pre - existing proxy settings if any . |
127,039 | public ProxySelector getOriginalProxySelector ( ) { return new ProxySelector ( ) { public List < Proxy > select ( URI uri ) { InetSocketAddress address = originalProxies . get ( uri . getScheme ( ) ) ; if ( address != null && ! ( originalNonProxyHosts . contains ( uri . getHost ( ) ) ) ) { return Collections . singleto... | Used by the Betamax proxy so that it can use pre - existing proxy settings when forwarding requests that do not match anything on tape . |
127,040 | public void lookupChainedProxies ( HttpRequest request , Queue < ChainedProxy > chainedProxies ) { final InetSocketAddress originalProxy = originalProxies . get ( URI . create ( request . getUri ( ) ) . getScheme ( ) ) ; if ( originalProxy != null ) { ChainedProxy chainProxy = new ChainedProxyAdapter ( ) { public InetS... | Used by LittleProxy to connect to a downstream proxy if there is one . |
127,041 | public void start ( String tapeName , Optional < TapeMode > mode , Optional < MatchRule > matchRule ) { if ( tape != null ) { throw new IllegalStateException ( "start called when Recorder is already started" ) ; } tape = getTapeLoader ( ) . loadTape ( tapeName ) ; tape . setMode ( mode . or ( configuration . getDefault... | Starts the Recorder inserting a tape with the specified parameters . |
127,042 | public void stop ( ) { if ( tape == null ) { throw new IllegalStateException ( "stop called when Recorder is not started" ) ; } for ( RecorderListener listener : listeners ) { listener . onRecorderStop ( ) ; } getTapeLoader ( ) . writeTape ( tape ) ; tape = null ; } | Stops the Recorder and writes its current tape out to a file . |
127,043 | public Collection < String > getIgnoreHosts ( ) { if ( isIgnoreLocalhost ( ) ) { return new ImmutableSet . Builder < String > ( ) . addAll ( ignoreHosts ) . addAll ( Network . getLocalAddresses ( ) ) . build ( ) ; } else { return ignoreHosts ; } } | Hosts that are ignored by Betamax . Any connections made will be allowed to proceed normally and not be intercepted . |
127,044 | public static Map < String , Object > getAnnotationAttributes ( Annotation annotation , boolean classValuesAsString ) { Map < String , Object > attrs = new HashMap < > ( ) ; Method [ ] methods = annotation . annotationType ( ) . getDeclaredMethods ( ) ; for ( Method method : methods ) { if ( method . getParameterTypes ... | Retrieve the given annotation s attributes as a Map . |
127,045 | protected static void enableOrDisableExternalEntityParsing ( DocumentBuilderFactory factory , boolean enableExternalEntities ) { String [ ] externalGeneralEntitiesFeatures = { "http://xml.org/sax/features/external-general-entities" , "http://xerces.apache.org/xerces-j/features.html#external-general-entities" , "http://... | Explicitly enable or disable the external - general - entities and external - parameter - entities features of the underlying DocumentBuilderFactory . |
127,046 | protected static Document createDocumentImpl ( String name , String namespaceURI , boolean enableExternalEntities , boolean isNamespaceAware ) throws ParserConfigurationException , FactoryConfigurationError { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( isNam... | Construct an XML Document with a default namespace with the given root element . |
127,047 | protected static Document parseDocumentImpl ( InputSource inputSource , boolean enableExternalEntities , boolean isNamespaceAware ) throws ParserConfigurationException , SAXException , IOException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( isNamespaceAwar... | Return an XML Document parsed from the given input source . |
127,048 | protected void stripWhitespaceOnlyTextNodesImpl ( ) throws XPathExpressionException { XPathFactory xpathFactory = XPathFactory . newInstance ( ) ; XPathExpression xpathExp = xpathFactory . newXPath ( ) . compile ( "//text()[normalize-space(.) = '']" ) ; NodeList emptyTextNodes = ( NodeList ) xpathExp . evaluate ( this ... | Find and delete from the underlying Document any text nodes that contain nothing but whitespace such as newlines and tab or space characters used to indent or pretty - print an XML document . |
127,049 | protected void importXMLBuilderImpl ( BaseXMLBuilder builder ) { assertElementContainsNoOrWhitespaceOnlyTextNodes ( this . xmlNode ) ; Node importedNode = getDocument ( ) . importNode ( builder . getDocument ( ) . getDocumentElement ( ) , true ) ; this . xmlNode . appendChild ( importedNode ) ; } | Imports another BaseXMLBuilder document into this document at the current position . The entire document provided is imported . |
127,050 | public Object xpathQuery ( String xpath , QName type , NamespaceContext nsContext ) throws XPathExpressionException { XPathFactory xpathFactory = XPathFactory . newInstance ( ) ; XPath xPath = xpathFactory . newXPath ( ) ; if ( nsContext != null ) { xPath . setNamespaceContext ( nsContext ) ; } XPathExpression xpathExp... | Return the result of evaluating an XPath query on the builder s DOM using the given namespace . Returns null if the query finds nothing or finds a node that does not match the type specified by returnType . |
127,051 | public Object xpathQuery ( String xpath , QName type ) throws XPathExpressionException { return xpathQuery ( xpath , type , null ) ; } | Return the result of evaluating an XPath query on the builder s DOM . Returns null if the query finds nothing or finds a node that does not match the type specified by returnType . |
127,052 | protected Element elementImpl ( String name , String namespaceURI ) { assertElementContainsNoOrWhitespaceOnlyTextNodes ( this . xmlNode ) ; if ( namespaceURI == null ) { return getDocument ( ) . createElement ( name ) ; } else { return getDocument ( ) . createElementNS ( namespaceURI , name ) ; } } | Add a named and namespaced XML element to the document as a child of this builder s node . |
127,053 | protected Element elementBeforeImpl ( String name ) { String prefix = getPrefixFromQualifiedName ( name ) ; String namespaceURI = this . xmlNode . lookupNamespaceURI ( prefix ) ; return elementBeforeImpl ( name , namespaceURI ) ; } | Add a named XML element to the document as a sibling element that precedes the position of this builder node . |
127,054 | protected Element elementBeforeImpl ( String name , String namespaceURI ) { Node parentNode = this . xmlNode . getParentNode ( ) ; assertElementContainsNoOrWhitespaceOnlyTextNodes ( parentNode ) ; Element newElement = ( namespaceURI == null ? getDocument ( ) . createElement ( name ) : getDocument ( ) . createElementNS ... | Add a named and namespaced XML element to the document as a sibling element that precedes the position of this builder node . |
127,055 | protected void attributeImpl ( String name , String value ) { if ( ! ( this . xmlNode instanceof Element ) ) { throw new RuntimeException ( "Cannot add an attribute to non-Element underlying node: " + this . xmlNode ) ; } ( ( Element ) xmlNode ) . setAttribute ( name , value ) ; } | Add a named attribute value to the element for this builder node . |
127,056 | protected void textImpl ( String value , boolean replaceText ) { if ( value == null ) { throw new IllegalArgumentException ( "Illegal null text value" ) ; } if ( replaceText ) { xmlNode . setTextContent ( value ) ; } else { xmlNode . appendChild ( getDocument ( ) . createTextNode ( value ) ) ; } } | Add or replace the text value of an element for this builder node . |
127,057 | protected void instructionImpl ( String target , String data ) { xmlNode . appendChild ( getDocument ( ) . createProcessingInstruction ( target , data ) ) ; } | Add an instruction to the element represented by this builder node . |
127,058 | protected void insertInstructionImpl ( String target , String data ) { getDocument ( ) . insertBefore ( getDocument ( ) . createProcessingInstruction ( target , data ) , xmlNode ) ; } | Insert an instruction before the element represented by this builder node . |
127,059 | protected void namespaceImpl ( String prefix , String namespaceURI ) { if ( ! ( this . xmlNode instanceof Element ) ) { throw new RuntimeException ( "Cannot add an attribute to non-Element underlying node: " + this . xmlNode ) ; } if ( prefix != null && prefix . length ( ) > 0 ) { ( ( Element ) xmlNode ) . setAttribute... | Add an XML namespace attribute to this builder s element node . |
127,060 | public String asString ( ) throws TransformerException { Properties outputProperties = new Properties ( ) ; outputProperties . put ( javax . xml . transform . OutputKeys . OMIT_XML_DECLARATION , "yes" ) ; return asString ( outputProperties ) ; } | Serialize the XML document to a string excluding the XML declaration . |
127,061 | public static XMLBuilder2 parse ( InputSource inputSource , boolean enableExternalEntities , boolean isNamespaceAware ) { try { return new XMLBuilder2 ( parseDocumentImpl ( inputSource , enableExternalEntities , isNamespaceAware ) ) ; } catch ( ParserConfigurationException e ) { throw wrapExceptionAsRuntimeException ( ... | Construct a builder from an existing XML document . The provided XML document will be parsed and an XMLBuilder2 object referencing the document s root element will be returned . |
127,062 | public static XMLBuilder2 parse ( String xmlString , boolean enableExternalEntities , boolean isNamespaceAware ) { return XMLBuilder2 . parse ( new InputSource ( new StringReader ( xmlString ) ) , enableExternalEntities , isNamespaceAware ) ; } | Construct a builder from an existing XML document string . The provided XML document will be parsed and an XMLBuilder2 object referencing the document s root element will be returned . |
127,063 | public static XMLBuilder2 parse ( File xmlFile , boolean enableExternalEntities , boolean isNamespaceAware ) { try { return XMLBuilder2 . parse ( new InputSource ( new FileReader ( xmlFile ) ) , enableExternalEntities , isNamespaceAware ) ; } catch ( FileNotFoundException e ) { throw wrapExceptionAsRuntimeException ( e... | Construct a builder from an existing XML document file . The provided XML document will be parsed and an XMLBuilder2 object referencing the document s root element will be returned . |
127,064 | private void initProperties ( ) { center = new SimpleObjectProperty < > ( ) ; center . addListener ( ( observable , oldValue , newValue ) -> { if ( newValue != lastCoordinateFromMap . get ( ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "center changed from {} to {}" , oldValue , newValue ) ; } setCenterIn... | initializes the JavaFX properties . |
127,065 | private void setCenterInMap ( ) { final Coordinate actCenter = getCenter ( ) ; if ( getInitialized ( ) && null != actCenter ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "setting center in OpenLayers map: {}, animation: {}" , actCenter , animationDuration . get ( ) ) ; } jsMapView . call ( "setCenter" , act... | sets the value of the center property in the OL map . |
127,066 | private void setZoomInMap ( ) { if ( getInitialized ( ) ) { final int zoomInt = ( int ) getZoom ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "setting zoom in OpenLayers map: {}, animation: {}" , zoomInt , animationDuration . get ( ) ) ; } jsMapView . call ( "setZoom" , zoomInt , animationDuration . get (... | sets the value of the actual zoom property in the OL map . |
127,067 | private boolean checkApiKey ( final MapType mapTypeToCheck ) { switch ( requireNonNull ( mapTypeToCheck ) ) { case BINGMAPS_ROAD : case BINGMAPS_AERIAL : return bingMapsApiKey . isPresent ( ) ; default : return true ; } } | checks if the given map type needs an api key and if so if it is set . |
127,068 | private void setMapTypeInMap ( ) { if ( getInitialized ( ) ) { final String mapTypeName = getMapType ( ) . toString ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setting map type in OpenLayers map: {}" , mapTypeName ) ; } bingMapsApiKey . ifPresent ( apiKey -> jsMapView . call ( "setBingMapsApiKey" , api... | sets the value of the mapType property in the OL map . |
127,069 | public MapView addCoordinateLine ( final CoordinateLine coordinateLine ) { if ( ! getInitialized ( ) ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( MAP_VIEW_NOT_YET_INITIALIZED ) ; } } else { synchronized ( coordinateLines ) { final String id = requireNonNull ( coordinateLine ) . getId ( ) ; if ( ! coordinateL... | add a CoordinateLine to the map . If it was already added nothing happens . The MapView only stores a weak reference to the object so the caller must keep a reference in order to prevent the line to be removed from the map . This method must only be called after the map is initialized otherwise a warning is logged and ... |
127,070 | private void setCoordinateLineVisibleInMap ( final String coordinateLineId ) { if ( null != coordinateLineId ) { final WeakReference < CoordinateLine > coordinateLineWeakReference = coordinateLines . get ( coordinateLineId ) ; if ( null != coordinateLineWeakReference ) { final CoordinateLine coordinateLine = coordinate... | shows or hides the coordinateline in the map according to it s visible property . |
127,071 | public MapView addLabel ( final MapLabel mapLabel ) { if ( ! getInitialized ( ) ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( MAP_VIEW_NOT_YET_INITIALIZED ) ; } } else { if ( null == requireNonNull ( mapLabel ) . getPosition ( ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "label with no position... | adds a label to the map . If it was already added nothing is changed . If the MapView is not yet initialized a warning is logged and nothing changes . If the label has no coordinate set it is not added and a logging entry is written . |
127,072 | private void addMapCoordinateElement ( final MapCoordinateElement mapCoordinateElement ) { final String id = mapCoordinateElement . getId ( ) ; final ChangeListener < Coordinate > coordinateChangeListener = ( observable , oldValue , newValue ) -> moveMapCoordinateElementInMap ( id ) ; final ChangeListener < Boolean > v... | sets up the internal information about a MapCoordinate Element . |
127,073 | private void setMarkerVisibleInMap ( final String id ) { if ( null != id ) { final WeakReference < MapCoordinateElement > weakReference = mapCoordinateElements . get ( id ) ; if ( null != weakReference ) { final MapCoordinateElement mapCoordinateElement = weakReference . get ( ) ; if ( null != mapCoordinateElement ) { ... | sets the visibility of a MapCoordinateElement in the map . |
127,074 | private void moveMapCoordinateElementInMap ( final String id ) { if ( getInitialized ( ) && null != id ) { final WeakReference < MapCoordinateElement > weakReference = mapCoordinateElements . get ( id ) ; if ( null != weakReference ) { final MapCoordinateElement mapCoordinateElement = weakReference . get ( ) ; if ( nul... | adjusts the mapCoordinateElement s position in the map . |
127,075 | public MapView addMarker ( final Marker marker ) { if ( ! getInitialized ( ) ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( MAP_VIEW_NOT_YET_INITIALIZED ) ; } } else { if ( null == requireNonNull ( marker ) . getPosition ( ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "marker with no position was... | adds a marker to the map . If it was already added nothing is changed . If the MapView is not yet initialized a warning is logged and nothing changes . If the marker has no coordinate set it is not added and a logging entry is written . |
127,076 | @ SuppressWarnings ( "UnusedDeclaration" ) private String createDataURI ( final URL imageURL ) { return imgCache . computeIfAbsent ( imageURL , url -> { String dataUrl = null ; try ( final InputStream isGuess = url . openStream ( ) ; final InputStream isConvert = url . openStream ( ) ; final ByteArrayOutputStream os = ... | loads an image and converts it s data to a base64 encoded data url . |
127,077 | public void showLink ( final String href ) { if ( null != href && ! href . isEmpty ( ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS asks to browse to {}" , href ) ; } if ( ! Desktop . isDesktopSupported ( ) ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( "no desktop support for displaying {}" ,... | called when an a href in the map is clicked and shows the URL in the default browser . |
127,078 | private void processMarkerClicked ( final String name , final ClickType clickType ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS reports marker {} clicked {}" , name , clickType ) ; } synchronized ( mapCoordinateElements ) { if ( mapCoordinateElements . containsKey ( name ) ) { final MapCoordinateElement... | processes a marker click |
127,079 | private void processLabelClicked ( final String name , final ClickType clickType ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS reports label {} clicked {}" , name , clickType ) ; } synchronized ( mapCoordinateElements ) { if ( mapCoordinateElements . containsKey ( name ) ) { final MapCoordinateElement m... | called when a label was clicked . |
127,080 | public void zoomChanged ( double newZoom ) { final long roundedZoom = Math . round ( newZoom ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS reports zoom value {}" , roundedZoom ) ; } lastZoomFromMap . set ( roundedZoom ) ; setZoom ( roundedZoom ) ; } | called when the user changed the zoom with the controls in the map . |
127,081 | public void extentSelected ( double latMin , double lonMin , double latMax , double lonMax ) { final Extent extent = Extent . forCoordinates ( new Coordinate ( latMin , lonMin ) , new Coordinate ( latMax , lonMax ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS reports extend selected: {}" , extent ) ; }... | called when the user selected an extent by dragging the mouse with modifier pressed . |
127,082 | public void extentChanged ( double latMin , double lonMin , double latMax , double lonMax ) { final Extent extent = Extent . forCoordinates ( new Coordinate ( latMin , lonMin ) , new Coordinate ( latMax , lonMax ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS reports extend change: {}" , extent ) ; } fi... | called when the map extent changed by changing the center or zoom of the map . |
127,083 | public static Extent forCoordinates ( Collection < ? extends Coordinate > coordinates ) { requireNonNull ( coordinates ) ; if ( coordinates . size ( ) < 2 ) { throw new IllegalArgumentException ( ) ; } double minLatitude = Double . MAX_VALUE ; double maxLatitude = - Double . MAX_VALUE ; double minLongitude = Double . M... | creates the extent of the given coordinates . |
127,084 | private URLStreamHandler getURLStreamHandler ( final String protocol ) { try { final Method method = URL . class . getDeclaredMethod ( "getURLStreamHandler" , String . class ) ; method . setAccessible ( true ) ; return ( URLStreamHandler ) method . invoke ( null , protocol ) ; } catch ( final Exception e ) { if ( logge... | returns the URL class s stream handler for a protocol . this uses inspection . |
127,085 | public URLStreamHandler createURLStreamHandler ( final String protocol ) { if ( null == protocol ) { throw new IllegalArgumentException ( "null protocol not allowed" ) ; } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "need to create URLStreamHandler for protocol {}" , protocol ) ; } final String proto = protoc... | default Handler for http and https . |
127,086 | public static Marker createProvided ( Provided provided ) { requireNonNull ( provided ) ; return new Marker ( Marker . class . getResource ( "/markers/" + provided . getFilename ( ) ) , provided . getOffsetX ( ) , provided . getOffsetY ( ) ) ; } | return a provided Marker with the given color . |
127,087 | public Marker attachLabel ( MapLabel mapLabel ) { optMapLabel = Optional . of ( requireNonNull ( mapLabel ) ) ; mapLabel . setMarker ( this ) ; mapLabel . visibleProperty ( ) . bind ( visibleProperty ( ) ) ; mapLabel . positionProperty ( ) . bind ( positionProperty ( ) ) ; return this ; } | attaches the MapLabel to this Marker |
127,088 | public Marker detachLabel ( ) { optMapLabel . ifPresent ( mapLabel -> { mapLabel . setMarker ( null ) ; mapLabel . visibleProperty ( ) . unbind ( ) ; mapLabel . positionProperty ( ) . unbind ( ) ; } ) ; optMapLabel = Optional . empty ( ) ; return this ; } | detaches an attached Label . |
127,089 | public Object parse ( SerializerHandler serializerHandler , InputStream response , boolean debugMode ) throws XMLRPCException { try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document d... | The given InputStream must contain the xml response from an xmlrpc server . This method extract the content of it as an object . |
127,090 | public static byte [ ] decode ( String in ) { in = in . replaceAll ( "\\r|\\n" , "" ) ; if ( in . length ( ) % 4 != 0 ) { throw new IllegalArgumentException ( "The length of the input string must be a multiple of four." ) ; } if ( ! in . matches ( "^[A-Za-z0-9+/]*[=]{0,3}$" ) ) { throw new IllegalArgumentException ( "T... | Decode a base64 encoded string to a byte array . |
127,091 | public static String encode ( Byte [ ] in ) { byte [ ] tmp = new byte [ in . length ] ; for ( int i = 0 ; i < tmp . length ; i ++ ) { tmp [ i ] = in [ i ] ; } return encode ( tmp ) ; } | Encode a Byte array and return the encoded string . |
127,092 | public static String encode ( byte [ ] in ) { StringBuilder builder = new StringBuilder ( 4 * ( ( in . length + 2 ) / 3 ) ) ; byte [ ] encoded = encodeAsBytes ( in ) ; for ( int i = 0 ; i < encoded . length ; i ++ ) { builder . append ( code [ encoded [ i ] + 1 ] ) ; if ( i % 72 == 71 ) builder . append ( "\n" ) ; } re... | Encode a byte array and return the encoded string . |
127,093 | public static byte [ ] encodeAsBytes ( byte [ ] inArray ) { byte [ ] out = new byte [ 4 * ( ( inArray . length + 2 ) / 3 ) ] ; byte [ ] in = new byte [ ( inArray . length + 2 ) / 3 * 3 ] ; System . arraycopy ( inArray , 0 , in , 0 , inArray . length ) ; int outi = 0 ; for ( int i = 0 ; i < in . length ; i += 3 ) { out ... | Encode a byte array and return the encoded byte array . Bytes that has been appended to pad the string to a multiple of four are set to - 1 in the array . |
127,094 | public void setAuthentication ( HttpURLConnection http ) { if ( user == null || pass == null || user . length ( ) <= 0 || pass . length ( ) <= 0 ) { return ; } String base64login = Base64 . encode ( user + ":" + pass ) ; http . addRequestProperty ( "Authorization" , "Basic " + base64login ) ; } | Set the authentication at the HttpURLConnection . |
127,095 | private XmlElement getXMLParam ( Object o ) throws XMLRPCException { XmlElement param = new XmlElement ( XMLRPCClient . PARAM ) ; XmlElement value = new XmlElement ( XMLRPCClient . VALUE ) ; param . addChildren ( value ) ; value . addChildren ( serializerHandler . serialize ( o ) ) ; return param ; } | Generates the param xml tag for a specific parameter object . |
127,096 | public void setCustomHttpHeader ( String headerName , String headerValue ) { if ( CONTENT_TYPE . equals ( headerName ) || HOST . equals ( headerName ) || CONTENT_LENGTH . equals ( headerName ) ) { throw new XMLRPCRuntimeException ( "You cannot modify the Host, Content-Type or Content-Length header." ) ; } httpParameter... | Set a HTTP header field to a custom value . You cannot modify the Host or Content - Type field that way . If the field already exists the old value is overwritten . |
127,097 | public long callAsync ( XMLRPCCallback listener , String methodName , Object ... params ) { long id = System . currentTimeMillis ( ) ; new Caller ( listener , id , methodName , params ) . start ( ) ; return id ; } | Asynchronously call a remote procedure on the server . The method must be described by a method name . If the method requires parameters this must be set . When the server returns a response the onResponse method is called on the listener . If the server returns an error the onServerError method is called on the listen... |
127,098 | public void cancel ( long id ) { Caller cancel = backgroundCalls . get ( id ) ; if ( cancel == null ) { return ; } cancel . cancel ( ) ; try { cancel . join ( ) ; } catch ( InterruptedException ex ) { } } | Cancel a specific asynchronous call . |
127,099 | private Call createCall ( String method , Object [ ] params ) { if ( isFlagSet ( FLAGS_STRICT ) && ! method . matches ( "^[A-Za-z0-9\\._:/]*$" ) ) { throw new XMLRPCRuntimeException ( "Method name must only contain A-Z a-z . : _ / " ) ; } return new Call ( serializerHandler , method , params ) ; } | Create a call object from a given method string and parameters . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.