signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Charset { /** * Returns a new { @ code ByteBuffer } containing the bytes encoding the characters from
* { @ code buffer } .
* This method uses { @ code CodingErrorAction . REPLACE } .
* < p > Applications should generally create a { @ link CharsetEncoder } using { @ link # newEncoder }
* for perfor... | try { return newEncoder ( ) . onMalformedInput ( CodingErrorAction . REPLACE ) . onUnmappableCharacter ( CodingErrorAction . REPLACE ) . encode ( buffer ) ; } catch ( CharacterCodingException ex ) { throw new Error ( ex . getMessage ( ) , ex ) ; } |
public class GlobalParameter { /** * Create a new GP entry in the database . No commit performed . */
public static GlobalParameter create ( DbConn cnx , String key , String value ) { } } | QueryResult r = cnx . runUpdate ( "globalprm_insert" , key , value ) ; GlobalParameter res = new GlobalParameter ( ) ; res . id = r . getGeneratedId ( ) ; res . key = key ; res . value = value ; return res ; |
public class ReverseBinaryEncoder { /** * Write contents of a local symbol table as a struct .
* The contents are the IST : : annotation , declared symbols , and import
* declarations ( that refer to shared symtabs ) if they exist .
* @ param symTab the local symbol table , not shared , not system */
private void... | assert symTab . isLocalTable ( ) ; final int originalOffset = myBuffer . length - myOffset ; // Write declared local symbol strings if any exists
writeSymbolsField ( symTab ) ; // Write import declarations if any exists
writeImportsField ( symTab ) ; // Write the struct prefix
writePrefix ( TYPE_STRUCT , myBuffer . len... |
public class HashIndex { /** * Returns an unmodifiable view of the Index . It is just
* a locked index that cannot be unlocked , so if you
* try to add something , nothing will happen ( it won ' t throw
* an exception ) . Trying to unlock it will throw an
* UnsupportedOperationException . If the
* underlying ... | HashIndex < E > newIndex = new HashIndex < E > ( ) { @ Override public void unlock ( ) { throw new UnsupportedOperationException ( "This is an unmodifiable view!" ) ; } private static final long serialVersionUID = 3415903369787491736L ; } ; newIndex . objects = objects ; newIndex . indexes = indexes ; newIndex . lock (... |
public class CmsStringUtil { /** * Extracts the xml encoding setting from an xml file that is contained in a String by parsing
* the xml head . < p >
* This is useful if you have a byte array that contains a xml String ,
* but you do not know the xml encoding setting . Since the encoding setting
* in the xml he... | String result = null ; Matcher xmlHeadMatcher = XML_HEAD_REGEX . matcher ( content ) ; if ( xmlHeadMatcher . find ( ) ) { String xmlHead = xmlHeadMatcher . group ( ) ; Matcher encodingMatcher = XML_ENCODING_REGEX . matcher ( xmlHead ) ; if ( encodingMatcher . find ( ) ) { String encoding = encodingMatcher . group ( ) ;... |
public class WSController { /** * A message is a call service request or subscribe / unsubscribe topic
* @ param client
* @ param json */
@ Override public void receiveCommandMessage ( Session client , String json ) { } } | MessageFromClient message = MessageFromClient . createFromJson ( json ) ; logger . debug ( "Receive call message in websocket '{}' for session '{}'" , message . getId ( ) , client . getId ( ) ) ; callServiceManager . sendMessageToClient ( message , client ) ; |
public class TargetLoginStage { /** * Returns < code > true < / code > , if and only if the specified PDU is a Login Request PDU and the CSN and
* InitiatorTaskTag fields check out .
* @ param pdu the PDU to check
* @ return < code > true < / code > if the PDU checks out */
protected boolean checkPdu ( ProtocolDa... | final BasicHeaderSegment bhs = pdu . getBasicHeaderSegment ( ) ; final LoginRequestParser parser = ( LoginRequestParser ) bhs . getParser ( ) ; if ( bhs . getOpCode ( ) == OperationCode . LOGIN_REQUEST && parser . getCurrentStageNumber ( ) == stageNumber && bhs . getInitiatorTaskTag ( ) == initiatorTaskTag ) return tru... |
public class BucketFlusher { /** * Initiates a flush request against the server .
* The result indicates if polling needs to be done or the flush is already complete . It can also fail in case
* flush is disabled or something else went wrong in the server response .
* @ param core the core reference .
* @ param... | return deferAndWatch ( new Func1 < Subscriber , Observable < FlushResponse > > ( ) { @ Override public Observable < FlushResponse > call ( Subscriber subscriber ) { FlushRequest request = new FlushRequest ( bucket , username , password ) ; request . subscriber ( subscriber ) ; return core . send ( request ) ; } } ) . r... |
public class MtasDataCollector { /** * Adds the .
* @ param increaseSourceNumber the increase source number
* @ return the mtas data collector
* @ throws IOException Signals that an I / O exception has occurred . */
protected final MtasDataCollector add ( boolean increaseSourceNumber ) throws IOException { } } | if ( ! closed ) { if ( ! collectorType . equals ( DataCollector . COLLECTOR_TYPE_DATA ) ) { throw new IOException ( "collector should be " + DataCollector . COLLECTOR_TYPE_DATA ) ; } else { if ( newPosition > 0 ) { newCurrentExisting = true ; } else if ( position < getSize ( ) ) { // copy
newKeyList [ 0 ] = keyList [ 0... |
public class Parser { /** * Parse the raw data .
* @ return parsed media information */
MediaInfo parse ( ) { } } | try { BufferedReader reader = new BufferedReader ( new StringReader ( data ) ) ; MediaInfo mediaInfo = new MediaInfo ( ) ; String sectionName ; String line ; Sections sections ; Section section = null ; while ( parseState != ParseState . FINISHED ) { switch ( parseState ) { case DEFAULT : parseState = ParseState . NEXT... |
public class FileUtilities { /** * Returns true if all deletions were successful . If a deletion fails , the method stops attempting to delete and
* returns false .
* @ param filehandle the file or folder to remove .
* @ return true if all deletions were successful
* @ throws IOException */
public static boolea... | if ( filehandle . isDirectory ( ) ) { Files . walkFileTree ( Paths . get ( filehandle . getAbsolutePath ( ) ) , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attrs ) throws IOException { Files . delete ( file ) ; return FileVisitResult . CONTINUE ; } ... |
public class MssPackageMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MssPackage mssPackage , ProtocolMarshaller protocolMarshaller ) { } } | if ( mssPackage == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( mssPackage . getEncryption ( ) , ENCRYPTION_BINDING ) ; protocolMarshaller . marshall ( mssPackage . getManifestWindowSeconds ( ) , MANIFESTWINDOWSECONDS_BINDING ) ; protocol... |
public class HelloDory { /** * Create a Dory client connection and execute the example commands . */
private void run ( String [ ] args ) { } } | if ( args . length != 2 ) { usage ( ) ; } System . out . println ( "Opening Doradus server: " + args [ 0 ] + ":" + args [ 1 ] ) ; try ( DoradusClient client = new DoradusClient ( args [ 0 ] , Integer . parseInt ( args [ 1 ] ) ) ) { deleteApplication ( client ) ; createApplication ( client ) ; addData ( client ) ; query... |
public class BootstrapConfig { /** * Get value from initial configuration properties . If property is not
* present in initial / framework properties , try finding it in system
* properties .
* @ param key
* Property key
* @ return Object value , or null if not found . */
public String get ( final String key ... | if ( key == null || initProps == null ) return null ; String value = initProps . get ( key ) ; if ( value == null ) { try { value = AccessController . doPrivileged ( new java . security . PrivilegedExceptionAction < String > ( ) { @ Override public String run ( ) throws Exception { return System . getProperty ( key ) ;... |
public class VFSStoreResource { /** * Tells the resource manager to forget about a heuristically completed
* transaction branch .
* @ param _ xid global transaction identifier ( not used , because each file
* with the file id gets a new VFS store resource instance ) */
@ Override public void forget ( final Xid _x... | if ( VFSStoreResource . LOG . isDebugEnabled ( ) ) { VFSStoreResource . LOG . debug ( "forget (xid = " + _xid + ")" ) ; } |
public class GalaxyProperties { /** * Gets path to a config file for Galaxy relative to the Galaxy root directory .
* This will check for the existence of the file and attempt to copy it from a * . sample file
* if it does not exist .
* @ param galaxyRoot The Galaxy root directory .
* @ param configFileName The... | if ( isPre20141006Release ( galaxyRoot ) ) { return configFileName ; } else { File configDirectory = new File ( galaxyRoot , CONFIG_DIR_NAME ) ; File toolConf = new File ( configDirectory , configFileName ) ; // if config file does not exist , copy it from the . sample version
if ( ! toolConf . exists ( ) ) { File tool... |
public class DJBar3DChartBuilder { /** * Adds the specified serie column to the dataset with custom label .
* @ param column the serie column
* @ param label column the custom label */
public DJBar3DChartBuilder addSerie ( AbstractColumn column , String label ) { } } | getDataset ( ) . addSerie ( column , label ) ; return this ; |
public class ClasspathResource { /** * @ see # ClasspathResource ( Class , String , boolean )
* @ param someClass is the class identifying the path where the resource is located and the prefix of its
* filename .
* @ param nameOrSuffix is the filename of the resource or a suffix ( e . g . " . properties " or " - ... | if ( append ) { return someClass . getName ( ) . replace ( '.' , '/' ) + nameOrSuffix ; } else { return someClass . getPackage ( ) . getName ( ) . replace ( '.' , '/' ) + '/' + nameOrSuffix ; } |
public class ApiOvhMe { /** * Get this object properties
* REST : GET / me / debtAccount / debt / { debtId }
* @ param debtId [ required ] */
public OvhDebt debtAccount_debt_debtId_GET ( Long debtId ) throws IOException { } } | String qPath = "/me/debtAccount/debt/{debtId}" ; StringBuilder sb = path ( qPath , debtId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhDebt . class ) ; |
public class ApproximateHistogram { /** * Returns a byte - array representation of this ApproximateHistogram object
* @ return byte array representation */
@ JsonValue public byte [ ] toBytes ( ) { } } | ByteBuffer buf = ByteBuffer . allocate ( getMinStorageSize ( ) ) ; toBytes ( buf ) ; return buf . array ( ) ; |
public class EpsReader { /** * Main method that parses all comments and then distributes data extraction among other methods that parse the
* rest of file and store encountered data in metadata ( if there exists an entry in EpsDirectory
* for the found data ) . Reads until a begin data / binary comment is found or ... | StringBuilder line = new StringBuilder ( ) ; while ( true ) { line . setLength ( 0 ) ; // Read the next line , excluding any trailing newline character
// Note that for Windows - style line endings ( " \ r \ n " ) the outer loop will be run a second time with an empty
// string , which is fine .
while ( true ) { char c... |
public class ZipFileContainerUtils { /** * Allocate an offsets list .
* If no discarded list is available , allocate a new list .
* Otherwise , use one of the discarded lists .
* @ param offsetsStorage Storage of discarded offset lists .
* @ return An allocated offsets list . */
private static List < Integer > ... | if ( offsetsStorage . isEmpty ( ) ) { return new ArrayList < Integer > ( ) ; } else { return ( offsetsStorage . remove ( 0 ) ) ; } |
public class CmsJspTagLink { /** * Returns a link to a file in the OpenCms VFS
* that has been adjusted according to the web application path and the
* OpenCms static export rules . < p >
* < p > If the < code > baseUri < / code > parameter is provided , this will be treated as the source of the link ,
* if thi... | return linkTagAction ( target , req , baseUri , null , locale ) ; |
public class Americanize { /** * Americanize and print the command line arguments .
* This main method is just for debugging .
* @ param args Command line arguments : a list of words */
public static void main ( String [ ] args ) throws IOException { } } | System . err . println ( new Americanize ( ) ) ; System . err . println ( ) ; if ( args . length == 0 ) { // stdin - > stdout :
BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = buf . readLine ( ) ) != null ) { for ( String w : line . split ( "\\s+" ) ) {... |
public class OffsetCharSequence { /** * Compares this char sequence to another char sequence < code > o < / code > .
* @ param o the other char sequence .
* @ return as defined in { @ link String # compareTo ( Object ) } but also takes
* { @ link # transform } into account . */
public int compareTo ( OffsetCharSe... | int len1 = length ( ) ; int len2 = other . length ( ) ; int lim = Math . min ( len1 , len2 ) ; for ( int i = 0 ; i < lim ; i ++ ) { char c1 = charAt ( i ) ; char c2 = other . charAt ( i ) ; if ( c1 != c2 ) { return c1 - c2 ; } } return len1 - len2 ; |
public class RelationImpl { /** * Reads some data from a RelationReified . If the Relation has not been reified then an empty
* Stream is returned . */
private < X > Stream < X > readFromReified ( Function < RelationReified , Stream < X > > producer ) { } } | return reified ( ) . map ( producer ) . orElseGet ( Stream :: empty ) ; |
public class Rectangle2dfx { /** * Replies the property that is the width of the box .
* @ return the width property . */
@ Pure public DoubleProperty widthProperty ( ) { } } | if ( this . width == null ) { this . width = new ReadOnlyDoubleWrapper ( this , MathFXAttributeNames . WIDTH ) ; this . width . bind ( Bindings . subtract ( maxXProperty ( ) , minXProperty ( ) ) ) ; } return this . width ; |
public class ScheduledTask { /** * Callable . call is invoked by the executor to run this task some time ( hopefully soon )
* after the scheduled execution time has been reached . */
@ FFDCIgnore ( Throwable . class ) @ Override public T call ( ) throws Exception { } } | final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( future . isCancelled ( ) ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "canceled - not running the task" ) ; return null ; } Result result = resultRef . get ( ) , resultForThisExecution = result ; Status < T > skipped = null ; ... |
public class ApitraryDaoSupport { /** * findAll .
* @ param entity
* a { @ link java . lang . Class } object .
* @ param < T >
* a T object .
* @ return a { @ link java . util . List } object . */
@ SuppressWarnings ( "unchecked" ) public < T > List < T > findAll ( Class < T > entity ) { } } | if ( entity == null ) { throw new ApitraryOrmException ( "Cannot access null entity" ) ; } log . debug ( "Loading all " + entity . getName ( ) ) ; QueriedGetRequest request = new QueriedGetRequest ( ) ; request . setEntity ( resolveApitraryEntity ( entity ) ) ; QueriedGetResponse response = resolveApitraryClient ( ) . ... |
public class IPv4PacketImpl { /** * Very naive initial implementation . Should be changed to do a better job
* and its performance probably can go up a lot as well .
* @ param startIndex
* @ param address */
private void setIP ( final int startIndex , final String address ) { } } | final String [ ] parts = address . split ( "\\." ) ; this . headers . setByte ( startIndex + 0 , ( byte ) Integer . parseInt ( parts [ 0 ] ) ) ; this . headers . setByte ( startIndex + 1 , ( byte ) Integer . parseInt ( parts [ 1 ] ) ) ; this . headers . setByte ( startIndex + 2 , ( byte ) Integer . parseInt ( parts [ 2... |
public class AdRule { /** * Gets the midroll value for this AdRule .
* @ return midroll * This { @ link AdRule } object ' s mid - roll slot . This attribute
* is required . */
public com . google . api . ads . admanager . axis . v201902 . BaseAdRuleSlot getMidroll ( ) { } } | return midroll ; |
public class lbwlm { /** * Use this API to fetch filtered set of lbwlm resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static lbwlm [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | lbwlm obj = new lbwlm ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; lbwlm [ ] response = ( lbwlm [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class ControlBeanContextServicesSupport { /** * Reports whether or not a given service is
* currently available from this context .
* @ param serviceClass the service in question
* @ return true if the service is available */
public synchronized boolean hasService ( Class serviceClass ) { } } | // todo : for multithreaded usage this block needs to be synchronized
ServiceProvider sp = _serviceProviders . get ( serviceClass ) ; if ( sp != null && ! sp . isRevoked ( ) ) { return true ; } // if service not found locally check in nested context
BeanContext bc = getBeanContext ( ) ; if ( bc instanceof BeanContextSe... |
public class Excel03SaxReader { /** * 处理行结束后的操作 , { @ link LastCellOfRowDummyRecord } 是行结束的标识Record
* @ param lastCell 行结束的标识Record */
private void processLastCell ( LastCellOfRowDummyRecord lastCell ) { } } | // 每行结束时 , 调用handle ( ) 方法
this . rowHandler . handle ( curSheetIndex , lastCell . getRow ( ) , this . rowCellList ) ; // 清空行Cache
this . rowCellList . clear ( ) ; |
public class EVCacheClientPool { /** * back to the read map . */
private void updateMemcachedReadInstancesByZone ( ) { } } | for ( ServerGroup serverGroup : memcachedInstancesByServerGroup . keySet ( ) ) { final BooleanProperty isZoneInWriteOnlyMode = writeOnlyFastPropertyMap . get ( serverGroup ) ; if ( isZoneInWriteOnlyMode . get ( ) . booleanValue ( ) ) { if ( memcachedReadInstancesByServerGroup . containsKey ( serverGroup ) ) { EVCacheMe... |
public class TargetSenderWorker { /** * Receives a < code > ProtocolDataUnit < / code > from the socket and appends it to the end of the receiving queue of this
* connection .
* @ return Queue with the resulting units
* @ throws IOException if an I / O error occurs .
* @ throws InternetSCSIException if any viol... | ProtocolDataUnit pdu ; if ( initialPdu ) { /* * The connection ' s ConnectionSettingsNegotiator has not been initialized , hence getSettings ( ) would throw a
* NullPointerException . Initialize PDU with default values , i . e . no digests . */
pdu = protocolDataUnitFactory . create ( TextKeyword . NONE , // header
/... |
public class PoolableObject { /** * Releases the current owning thread from this Object
* @ param < K > the Key wrapped Type
* @ param < E > the Entry type
* @ return PoolableObject for method chaining */
@ SuppressWarnings ( "unchecked" ) < K , E extends PoolableObject < V > > E releaseOwner ( ) { } } | this . owner = null ; return ( E ) this ; |
public class TIFFField { /** * Returns data in any numerical format as a float . Data in
* TIFF _ SRATIONAL or TIFF _ RATIONAL format are evaluated by
* dividing the numerator into the denominator using
* double - precision arithmetic and then truncating to single
* precision . Data in TIFF _ SLONG , TIFF _ LON... | switch ( type ) { case TIFF_BYTE : return ( ( byte [ ] ) data ) [ index ] & 0xff ; case TIFF_SBYTE : return ( ( byte [ ] ) data ) [ index ] ; case TIFF_SHORT : return ( ( char [ ] ) data ) [ index ] & 0xffff ; case TIFF_SSHORT : return ( ( short [ ] ) data ) [ index ] ; case TIFF_SLONG : return ( ( int [ ] ) data ) [ i... |
public class StatementGroup { /** * Returns a list of all parameters contained by this statement group ' s
* statements , and nested statement groups .
* @ return List of parameters */
public List < Parameter > getAllParameters ( ) { } } | List < Parameter > ret = new ArrayList < Parameter > ( ) ; // Parameters within statements
if ( statements != null ) { for ( final Statement stmt : statements ) ret . addAll ( stmt . getAllParameters ( ) ) ; } // Parameters within nested statement groups
if ( statementGroups != null ) { for ( final StatementGroup sg : ... |
public class JoinedQueryExecutor { /** * Builds and returns a complex joined excutor against a chained property ,
* supporting multi - way joins . Filtering and ordering may also be supplied ,
* in order to better distribute work throughout the join .
* @ param repoAccess used to create query executors for outer ... | if ( targetOrdering == null ) { targetOrdering = OrderingList . emptyList ( ) ; } QueryExecutor < T > executor = buildJoin ( repoAccess , targetToSourceProperty , targetFilter , targetOrdering , hints ) ; OrderingList < T > handledOrdering = executor . getOrdering ( ) ; // Apply sort if any remaining ordering propertie... |
public class Global { /** * Load a Java class that defines a JavaScript object using the
* conventions outlined in ScriptableObject . defineClass .
* This method is defined as a JavaScript function .
* @ exception IllegalAccessException if access is not available
* to a reflected class member
* @ exception In... | "unchecked" } ) public static void defineClass ( Context cx , Scriptable thisObj , Object [ ] args , Function funObj ) throws IllegalAccessException , InstantiationException , InvocationTargetException { Class < ? > clazz = getClass ( args ) ; if ( ! Scriptable . class . isAssignableFrom ( clazz ) ) { throw reportRunti... |
public class CLDRBase { /** * Add a language alias entry . */
protected static void addLanguageAlias ( String rawType , String rawReplacement ) { } } | LanguageAlias type = LanguageAlias . parse ( rawType ) ; LanguageAlias replacement = LanguageAlias . parse ( rawReplacement ) ; String language = type . language ( ) ; List < Pair < LanguageAlias , LanguageAlias > > aliases = LANGUAGE_ALIAS_MAP . get ( language ) ; if ( aliases == null ) { aliases = new ArrayList < > (... |
public class AbstractTypeBuilder { /** * Visits an annotation and adds a corresponding node to the
* specified Element .
* Despite the name , this method is not inherited through any
* visitor interface . It is not intended for external calls .
* @ param parent the target of the annotation
* @ param annotatio... | "parent != null" , "annotation != null" , "owner != null" , "p != null" } ) protected void visitAnnotation ( Element parent , AnnotationMirror annotation , boolean primary , ClassName owner , ElementModel p ) { if ( utils . isContractAnnotation ( annotation ) ) { ContractAnnotationModel model = createContractModel ( pa... |
public class MoreCollectors { /** * Returns a { @ code Collector } which aggregates the results of two supplied
* collectors using the supplied finisher function .
* This method returns a
* < a href = " package - summary . html # ShortCircuitReduction " > short - circuiting
* collector < / a > if both downstrea... | EnumSet < Characteristics > c = EnumSet . noneOf ( Characteristics . class ) ; c . addAll ( c1 . characteristics ( ) ) ; c . retainAll ( c2 . characteristics ( ) ) ; c . remove ( Characteristics . IDENTITY_FINISH ) ; Supplier < A1 > c1Supplier = c1 . supplier ( ) ; Supplier < A2 > c2Supplier = c2 . supplier ( ) ; BiCon... |
public class BaseWindowedBolt { /** * define max lag in ms , only for event time windows
* @ param maxLag max lag time */
public BaseWindowedBolt < T > withMaxLagMs ( Time maxLag ) { } } | this . maxLagMs = maxLag . toMilliseconds ( ) ; ensureNonNegativeTime ( maxLagMs ) ; return this ; |
public class PrimeExceptionHandler { /** * Builds the view if not already available . This is mostly required for ViewExpiredException ' s .
* @ param context The { @ link FacesContext } .
* @ param throwable The occurred { @ link Throwable } .
* @ param rootCause The root cause .
* @ return The unwrapped { @ l... | if ( context . getViewRoot ( ) == null ) { ViewHandler viewHandler = context . getApplication ( ) . getViewHandler ( ) ; String viewId = viewHandler . deriveViewId ( context , ComponentUtils . calculateViewId ( context ) ) ; ViewDeclarationLanguage vdl = viewHandler . getViewDeclarationLanguage ( context , viewId ) ; U... |
public class CmsJlanSearch { /** * Returns the next file object in the search result . < p >
* @ return the next file object */
protected CmsJlanNetworkFile nextFile ( ) { } } | if ( ! hasMoreFiles ( ) ) { return null ; } CmsJlanNetworkFile file = m_files . get ( m_position ) ; m_position += 1 ; return file ; |
public class FileUtils { /** * Reads a file and returns the result in a String
* @ param file File
* @ return String
* @ throws IOException */
public static String read ( final File file ) throws IOException { } } | final StringBuilder sb = new StringBuilder ( ) ; try ( final FileReader fr = new FileReader ( file ) ; final BufferedReader br = new BufferedReader ( fr ) ; ) { String sCurrentLine ; while ( ( sCurrentLine = br . readLine ( ) ) != null ) { sb . append ( sCurrentLine ) ; } } return sb . toString ( ) ; |
public class JQLChecker { /** * Replace place holder with element passed by listener .
* @ param context
* the context
* @ param jql
* the jql
* @ param listener
* the listener
* @ return string obtained by replacements */
public String replaceFromVariableStatement ( JQLContext context , String jql , fina... | JQLRewriterListener rewriterListener = new JQLRewriterListener ( ) ; rewriterListener . init ( listener ) ; return replaceFromVariableStatementInternal ( context , jql , replace , rewriterListener ) ; |
public class IPSettings { /** * returns a single , best matching node for the given address
* @ param addr
* @ return */
public IPRangeNode get ( InetAddress addr ) { } } | if ( version == 0 ) // no data was added
return null ; IPRangeNode node = isV4 ( addr ) ? ipv4 : ipv6 ; if ( ! this . isSorted ) this . optimize ( ) ; return node . findFast ( addr ) ; |
public class ClassUtil { /** * It ' s designed for field / method / class / column / table names . and source and target Strings will be cached .
* @ param str
* @ return */
public static String toUpperCaseWithUnderscore ( final String str ) { } } | if ( N . isNullOrEmpty ( str ) ) { return str ; } String result = upperCaseWithUnderscorePropNamePool . get ( str ) ; if ( result == null ) { result = StringUtil . toUpperCaseWithUnderscore ( str ) ; upperCaseWithUnderscorePropNamePool . put ( str , result ) ; } return result ; |
public class ServiceManagerAmpWrapper { /** * @ Override
* public < T > T createPinProxy ( ServiceRefAmp actorRef ,
* Class < T > api ,
* Class < ? > . . . apis )
* return getDelegate ( ) . createPinProxy ( actorRef , api , apis ) ; */
@ Override public ServiceRefAmp bind ( ServiceRefAmp service , String addres... | return delegate ( ) . bind ( service , address ) ; |
public class Results { /** * A redirect that uses 303 see other .
* The redirect does NOT need a template and does NOT
* render a text in the Http body by default .
* If you wish to do so please
* remove the { @ link NoHttpBody } that is set as renderable of
* the Result .
* @ param url The url used as redi... | return status ( Result . SEE_OTHER ) . with ( HeaderNames . LOCATION , url ) . render ( NoHttpBody . INSTANCE ) ; |
public class StandardSocketServer { /** * Contains the loop that waits for and handles incoming connections . */
public void run ( ) { } } | try { while ( true ) { // server thread blocks until a client connects
Socket socket = server . accept ( ) ; System . out . println ( new LogEntry ( "client (" + socket . getInetAddress ( ) . getHostAddress ( ) + ") attempts to connect..." ) ) ; Connection c = establishConnection ( socket ) ; updateConnectedClients ( c... |
public class FilesystemIterator { /** * Gets the rule that best suits the provided filename . The rule is the longer
* rule between the regular rules and the prefix rules .
* The regular rules are scanned first by looking through the filename and then
* all parents up to the root for the first match . These use M... | String longestPrefix = null ; FilesystemIteratorRule rule = null ; // First search the path and all of its parents for the first regular rule
String path = filename ; while ( true ) { // Check the current path for an exact match
// System . out . println ( " DEBUG : Checking " + path ) ;
rule = rules . get ( path ) ; i... |
public class UTF16 { /** * Check if the string buffer contains more Unicode code points than a certain number . This is
* more efficient than counting all code points in the entire string buffer and comparing that
* number with a threshold . This function may not need to scan the string buffer at all if the
* len... | if ( number < 0 ) { return true ; } if ( source == null ) { return false ; } int length = source . length ( ) ; // length > = 0 known
// source contains at least ( length + 1 ) / 2 code points : < = 2
// chars per cp
if ( ( ( length + 1 ) >> 1 ) > number ) { return true ; } // check if source does not even contain enou... |
public class WorkspaceDataContainerBase { /** * { @ inheritDoc } */
public Calendar getCurrentTime ( ) { } } | Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( new Date ( ) ) ; return cal ; |
public class JDBC4CallableStatement { /** * Sets the designated parameter to the given java . sql . Time value . */
@ Override public void setTime ( String parameterName , Time x ) throws SQLException { } } | checkClosed ( ) ; throw SQLError . noSupport ( ) ; |
public class DoubleIntegerDBIDKNNHeap { /** * Ensure the ties array has capacity for at least one more element .
* @ param id
* Id to add */
private void addToTies ( int id ) { } } | if ( ties . length == numties ) { ties = Arrays . copyOf ( ties , ( ties . length << 1 ) + 1 ) ; // grow .
} ties [ numties ] = id ; ++ numties ; |
public class AuthToken { /** * Create a copy of this AuthToken
* @ return a new AuthToken object */
public AuthToken copy ( ) { } } | final AuthToken authToken = new AuthToken ( key ) ; authToken . tokenName = tokenName ; authToken . startTime = startTime ; authToken . expiration = expiration ; authToken . ip = ip ; authToken . acl = acl ; authToken . duration = duration ; return authToken ; |
public class Occurrence { /** * 统计词频
* @ param key 增加一个词 */
public void addTerm ( String key ) { } } | TermFrequency value = trieSingle . get ( key ) ; if ( value == null ) { value = new TermFrequency ( key ) ; trieSingle . put ( key , value ) ; } else { value . increase ( ) ; } ++ totalTerm ; |
public class ClassLoaderReflectionToolkit { /** * Calls { @ link ClassLoader # findLoadedClass } while holding { @ link ClassLoader # getClassLoadingLock } .
* @ since 1.553 */
public static @ CheckForNull Class < ? > _findLoadedClass ( ClassLoader cl , String name ) { } } | synchronized ( getClassLoadingLock ( cl , name ) ) { return ( Class ) invoke ( FIND_LOADED_CLASS , RuntimeException . class , cl , name ) ; } |
public class NonSyncHashtable { /** * Returns the value to which the specified key is mapped in this hashtable .
* @ param key a key in the hashtable .
* @ return The value to which the key is mapped in this hashtable ;
* < code > null < / code > if the key is not mapped to any value in
* this hashtable . */
pu... | NonSyncHashtableEntry tab [ ] = table ; int hash = key . hashCode ( ) ; int index = ( hash & 0x7FFFFFFF ) % tab . length ; for ( NonSyncHashtableEntry e = tab [ index ] ; e != null ; e = e . next ) { if ( ( e . hash == hash ) && e . key . equals ( key ) ) { return e . value ; } } return null ; |
public class KPSwitchConflictUtil { /** * Hide the panel and the keyboard .
* @ param panelLayout the layout of panel . */
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 ( ) ; } panelLayout . setVisibility ( View . GONE ) ; |
public class S3Dispatcher { /** * Handles POST / bucket / id ? uploads
* @ param ctx the context describing the current request
* @ param bucket the bucket containing the object to upload
* @ param id name of the object to upload */
private void startMultipartUpload ( WebContext ctx , Bucket bucket , String id ) ... | Response response = ctx . respondWith ( ) ; Map < String , String > properties = Maps . newTreeMap ( ) ; for ( String name : ctx . getRequest ( ) . headers ( ) . names ( ) ) { String nameLower = name . toLowerCase ( ) ; if ( nameLower . startsWith ( "x-amz-meta-" ) || "content-md5" . equals ( nameLower ) || "content-ty... |
public class FileUtils { /** * Devuelve el nombre de un path , por ejmeplo : / dir / toto . txt > toto . txt o en windows \ toto \ toto . txt > toto . txt .
* El separador se escoje en funcion de si la el fileNameAndPath ya contien \ o /
* @ param fileNameAndPath contiene un path y un nombre del fichero , ej : / di... | if ( fileNameAndPath == null ) { return null ; } String fileSeparator ; if ( fileNameAndPath . contains ( "/" ) ) { fileSeparator = "/" ; } else { fileSeparator = "\\" ; } int lastIndexOf = fileNameAndPath . lastIndexOf ( fileSeparator ) ; if ( lastIndexOf < 0 ) { return fileNameAndPath ; } else { return fileNameAndPat... |
public class ConnectionDAODefaultImpl { public void init ( final Connection connection , final String host , final String port ) throws DevFailed { } } | connection . url = new TangoUrl ( buildUrlName ( TangoUrl . getCanonicalName ( host ) , port ) ) ; connection . setDevice_is_dbase ( true ) ; connection . transparent_reconnection = true ; // Always true for Database
ApiUtil . get_orb ( ) ; connect_to_dbase ( connection ) ; connection . devname = connection . device . ... |
public class PhoneNumberValueRestValidator { /** * { @ inheritDoc } initialize the validator .
* @ see javax . validation . ConstraintValidator # initialize ( java . lang . annotation . Annotation ) */
@ Override public final void initialize ( final PhoneNumberValueRest pconstraintAnnotation ) { } } | message = pconstraintAnnotation . message ( ) ; fieldPhoneNumber = pconstraintAnnotation . fieldPhoneNumber ( ) ; fieldCountryCode = pconstraintAnnotation . fieldCountryCode ( ) ; allowDin5008 = pconstraintAnnotation . allowDin5008 ( ) ; allowE123 = pconstraintAnnotation . allowE123 ( ) ; allowUri = pconstraintAnnotati... |
public class BytesWritable { /** * Set the value to a copy of the given byte range
* @ param newData the new values to copy in
* @ param offset the offset in newData to start at
* @ param length the number of bytes to copy */
public void set ( byte [ ] newData , int offset , int length ) { } } | setSize ( 0 ) ; setSize ( length ) ; System . arraycopy ( newData , offset , bytes , 0 , size ) ; |
public class Do { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > set a label of a node in the DO part of a FOREACH expression < / i > < / div >
* < div... | ModifyTerminal mt = ModifyFactory . setLabel ( label ) ; ASTNode clause = APIObjectAccess . getAstNode ( mt ) ; clause . setClauseType ( ClauseType . SET ) ; return createConcat ( clause ) ; |
public class CleanupThread { /** * { @ inheritDoc } */
@ Override public void run ( ) { } } | try { boolean retry = true ; while ( retry && active ) { // Get all threads , wait for ' foreign ' ( = = not our own threads )
// and when all finished , finish as well . This is in order to avoid
// hanging endless because the HTTP Server thread cant be set into
// daemon mode
Thread threads [ ] = enumerateThreads ( )... |
public class CommerceDiscountUsageEntryUtil { /** * Returns the last commerce discount usage entry in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commer... | return getPersistence ( ) . findByGroupId_Last ( groupId , orderByComparator ) ; |
public class StrBuilder { /** * Appends one of both separators to the StrBuilder .
* If the builder is currently empty it will append the defaultIfEmpty - separator
* Otherwise it will append the standard - separator
* Appending a null separator will have no effect .
* The separator is appended using { @ link #... | final String str = isEmpty ( ) ? defaultIfEmpty : standard ; if ( str != null ) { append ( str ) ; } return this ; |
public class Op { /** * Creates an < i > operation expression < / i > on the specified target object .
* @ param target the target object on which the expression will execute
* @ return an operator , ready for chaining */
public static < T > Level0ArrayOperator < String [ ] , String > on ( final String [ ] target )... | return onArrayOf ( Types . STRING , target ) ; |
public class LabsInner { /** * Add users to a lab .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param emailAddresses List of user emails addresses to add to the lab .
* @ param serviceCallback t... | return ServiceFuture . fromResponse ( addUsersWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , emailAddresses ) , serviceCallback ) ; |
public class FleetReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return Fleet ResourceSet */
@ Override public ResourceSet < Fleet > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class MQMessageUtils { /** * match return List , not match return null */
public static HashMode getPartitionHashColumns ( String name , String pkHashConfigs ) { } } | if ( StringUtils . isEmpty ( pkHashConfigs ) ) { return null ; } List < PartitionData > datas = partitionDatas . get ( pkHashConfigs ) ; for ( PartitionData data : datas ) { if ( data . simpleName != null ) { if ( data . simpleName . equalsIgnoreCase ( name ) ) { return data . hashMode ; } } else { if ( data . regexFil... |
public class StorageAccountsInner { /** * Updates the specified Data Lake Analytics account to add an Azure Storage account .
* @ param resourceGroupName The name of the Azure resource group .
* @ param accountName The name of the Data Lake Analytics account .
* @ param storageAccountName The name of the Azure St... | return ServiceFuture . fromResponse ( addWithServiceResponseAsync ( resourceGroupName , accountName , storageAccountName , parameters ) , serviceCallback ) ; |
public class ECDSASignature { /** * Will automatically adjust the S component to be less than or equal to half the curve
* order , if necessary . This is required because for every signature ( r , s ) the signature
* ( r , - s ( mod N ) ) is a valid signature of the same message . However , we dislike the
* abili... | if ( ! isCanonical ( ) ) { // The order of the curve is the number of valid points that exist on that curve .
// If S is in the upper half of the number of valid points , then bring it back to
// the lower half . Otherwise , imagine that
// N = 10
// s = 8 , so ( - 8 % 10 = = 2 ) thus both ( r , 8 ) and ( r , 2 ) are v... |
public class JsonFilesScanner { /** * / * map - > object */
public DataObject object ( File [ ] files , int start , int count ) { } } | return STRUCT . fromMapsAndCollections ( map ( files , start , count ) ) ; |
public class CPInstancePersistenceImpl { /** * Returns the first cp instance in the ordered set where CPDefinitionId = & # 63 ; and status & ne ; & # 63 ; .
* @ param CPDefinitionId the cp definition ID
* @ param status the status
* @ param orderByComparator the comparator to order the set by ( optionally < code ... | List < CPInstance > list = findByC_NotST ( CPDefinitionId , status , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class UnresolvedBindingValidator { /** * Prune all of the invalid optional keys from the graph . After this method , all of the keys
* remaining in the graph are resolvable . */
public void pruneInvalidOptional ( DependencyExplorerOutput output , InvalidKeys invalidKeys ) { } } | DependencyGraph . GraphPruner prunedGraph = new DependencyGraph . GraphPruner ( output . getGraph ( ) ) ; for ( Key < ? > key : invalidKeys . getInvalidOptionalKeys ( ) ) { prunedGraph . remove ( key ) ; output . removeBinding ( key ) ; } output . setGraph ( prunedGraph . update ( ) ) ; |
public class MessageFormat { /** * Finds the ChoiceFormat sub - message for the given number .
* @ param pattern A MessagePattern .
* @ param partIndex the index of the first ChoiceFormat argument style part .
* @ param number a number to be mapped to one of the ChoiceFormat argument ' s intervals
* @ return th... | int count = pattern . countParts ( ) ; int msgStart ; // Iterate over ( ARG _ INT | DOUBLE , ARG _ SELECTOR , message ) tuples
// until ARG _ LIMIT or end of choice - only pattern .
// Ignore the first number and selector and start the loop on the first message .
partIndex += 2 ; for ( ; ; ) { // Skip but remember the ... |
public class LocaleTemplateEnumerator { /** * Generate the next combination of template name and return .
* @ return the next combination of template name */
@ Override public String next ( ) { } } | if ( hasNext ( ) ) { if ( enumerationSize == NULL_LOCALE_ENUMERATION_SIZE ) { cursor ++ ; return templateName ; } final String language = matcher . group ( 1 ) ; final String country = matcher . group ( 2 ) ; switch ( cursor ) { case 0 : cursor ++ ; return templateName + FILE_SEPARATOR + language + FILE_SEPARATOR + cou... |
public class DefaultFXMLControllerFactory { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) @ Override public Object call ( final Class < ? > controllerClass ) { } } | FXMLController < Model , View < Model , ? , ? > > controller = null ; try { controller = ( FXMLController < Model , View < Model , ? , ? > > ) controllerClass . newInstance ( ) ; controller . model ( relatedModel ( ) ) ; } catch ( InstantiationException | IllegalAccessException e ) { LOGGER . log ( FXMLMessages . DEFAU... |
public class ExtendedMessageFormat { /** * Get a custom format from a format description .
* @ param desc
* String
* @ return Format */
private Format getFormat ( String desc ) { } } | if ( registry != null ) { String name = desc ; String args = "" ; int i = desc . indexOf ( START_FMT ) ; if ( i > 0 ) { name = desc . substring ( 0 , i ) . trim ( ) ; args = desc . substring ( i + 1 ) . trim ( ) ; } FormatFactory factory = registry . get ( name ) ; if ( factory != null ) { return factory . getFormat ( ... |
public class KafkaQueue { /** * Setter for { @ link # kafkaClient } .
* @ param kafkaClient
* @ param setMyOwnKafkaClient
* @ return */
protected KafkaQueue < ID , DATA > setKafkaClient ( KafkaClient kafkaClient , boolean setMyOwnKafkaClient ) { } } | if ( this . kafkaClient != null && myOwnKafkaClient ) { this . kafkaClient . destroy ( ) ; } this . kafkaClient = kafkaClient ; myOwnKafkaClient = setMyOwnKafkaClient ; return this ; |
public class JSDocInfo { /** * Documents the block - level comment / description .
* @ param description the description */
boolean documentBlock ( String description ) { } } | if ( ! lazyInitDocumentation ( ) ) { return true ; } if ( documentation . blockDescription != null ) { return false ; } documentation . blockDescription = description ; return true ; |
public class LatencyLimiter { /** * Throttle the execution process and re - adjust the rate requirement on the fly . The limiter will automatically re - adjust the rate internally by using a basic { @ link RateLimiter } after analysis of the latency data gathered from the performance tracking .
* @ param verbose the ... | // Observe latency to adjust the rate to reach target latency
if ( System . currentTimeMillis ( ) - this . LastCheck > 5000l ) { if ( this . End . getExecutionCount ( ) - this . Start . getExecutionCount ( ) > 0 ) { double observedLatency = ( double ) ( this . End . getTotalExecutionDuration ( ) - this . Start . getTot... |
public class SegmentsStylingPolicy { /** * Select a segment
* @ param segment Segment to select */
protected void selectSegment ( Segment segment ) { } } | if ( segment . isUnpaired ( ) ) { // remember selected unpaired segment
for ( Segment other : segments . getPairedSegments ( segment ) ) { indirectSelections . put ( other , segment ) ; selectSegment ( other ) ; } } else { if ( ! selectedSegments . contains ( segment ) ) { selectedSegments . add ( segment ) ; if ( segm... |
public class AbstractExecution { /** * { @ inheritDoc } */
public void checkParameters ( ) throws ExecutionException { } } | if ( isFailIfNoFiles ( ) && ( files == null || files . isEmpty ( ) ) ) { throw new ExecutionException ( "No file to process." ) ; } if ( isFailIfNoAlgorithms ( ) && ( algorithms == null || algorithms . isEmpty ( ) ) ) { throw new ExecutionException ( "No checksum algorithm defined." ) ; } if ( isFailIfNoTargets ( ) && ... |
public class SpeakUtil { /** * Sends a speak notification to the specified place object originating with the specified
* speaker ( the speaker optionally being a server entity that wishes to fake a " speak " message )
* and with the supplied message content .
* @ param speakObj the object on which to generate the... | sendSpeak ( speakObj , speaker , bundle , message , ChatCodes . DEFAULT_MODE ) ; |
public class authenticationvserver_authenticationldappolicy_binding { /** * Use this API to fetch authenticationvserver _ authenticationldappolicy _ binding resources of given name . */
public static authenticationvserver_authenticationldappolicy_binding [ ] get ( nitro_service service , String name ) throws Exception ... | authenticationvserver_authenticationldappolicy_binding obj = new authenticationvserver_authenticationldappolicy_binding ( ) ; obj . set_name ( name ) ; authenticationvserver_authenticationldappolicy_binding response [ ] = ( authenticationvserver_authenticationldappolicy_binding [ ] ) obj . get_resources ( service ) ; r... |
public class DefaultNamespaceContext { /** * Declared the specified { @ code uri } in this namespaceContext and returns
* the prefix to which it is bound .
* the prefix is guessed from the suggested namespaces specified at construction
* or derived from the specified { @ code uri }
* @ param uri uri to be decla... | String prefix = getPrefix ( uri ) ; if ( prefix == null ) { prefix = URLUtil . suggestPrefix ( suggested , uri ) ; if ( getNamespaceURI ( prefix ) != null ) { int i = 1 ; String _prefix ; while ( true ) { _prefix = prefix + i ; if ( getNamespaceURI ( _prefix ) == null ) { prefix = _prefix ; break ; } i ++ ; } } declare... |
public class SQLExpressions { /** * REGR _ COUNT returns an integer that is the number of non - null number pairs used to fit the regression line .
* @ param arg1 first arg
* @ param arg2 second arg
* @ return regr _ count ( arg1 , arg2) */
public static WindowOver < Double > regrCount ( Expression < ? extends Nu... | return new WindowOver < Double > ( Double . class , SQLOps . REGR_COUNT , arg1 , arg2 ) ; |
public class GeoJsonRead { /** * Read the GeoJSON file .
* @ param connection
* @ param fileName
* @ param tableReference
* @ throws IOException
* @ throws SQLException */
public static void readGeoJson ( Connection connection , String fileName , String tableReference ) throws IOException , SQLException { } } | GeoJsonDriverFunction gjdf = new GeoJsonDriverFunction ( ) ; gjdf . importFile ( connection , tableReference , URIUtilities . fileFromString ( fileName ) , new EmptyProgressVisitor ( ) ) ; |
public class Matrix4x3d { /** * Apply a symmetric orthographic projection transformation for a left - handed coordinate system
* using the given NDC z range to this matrix .
* This method is equivalent to calling { @ link # orthoLH ( double , double , double , double , double , double , boolean ) orthoLH ( ) } with... | return orthoSymmetricLH ( width , height , zNear , zFar , zZeroToOne , this ) ; |
public class AvailabilityTable { /** * Retrieve the table entry valid for the supplied date .
* @ param date required date
* @ return cost rate table entry */
public Availability getEntryByDate ( Date date ) { } } | Availability result = null ; for ( Availability entry : this ) { DateRange range = entry . getRange ( ) ; int comparisonResult = range . compareTo ( date ) ; if ( comparisonResult >= 0 ) { if ( comparisonResult == 0 ) { result = entry ; break ; } } else { break ; } } return result ; |
public class AbstractSqlFluent { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . fluent . SqlFluent # param ( String , Supplier ) */
@ SuppressWarnings ( "unchecked" ) @ Override public T param ( final String paramName , final Supplier < Object > supplier ) { } } | context ( ) . param ( paramName , supplier ) ; return ( T ) this ; |
public class ParameterTool { /** * Returns the String value for the given key .
* If the key does not exist it will return null . */
public String get ( String key ) { } } | addToDefaults ( key , null ) ; unrequestedParameters . remove ( key ) ; return data . get ( key ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.