public response put ( input stream is , @ context uri info uri info , @ path param ( " path " ) string path , @ query param ( operation param name ) operation param op , @ context parameters params , @ context http servlet request request ) throws i o exception , file system access exception { / / do not allow put commands in read - only mode if ( access mode = = access mode readonly ) { return response status ( response status forbidden ) build ( ) ; } user group information user = http user group information get ( ) ; response response ; path = make absolute ( path ) ; mdc put ( http f s file system op param , op value ( ) name ( ) ) ; mdc put ( " hostname " , request get remote addr ( ) ) ; switch ( op value ( ) ) { case create : { boolean has data = params get ( data param name , data param class ) ; uri redirect u r l = create upload redirection u r l ( uri info , http f s file system operation create ) ; boolean no redirect = params get ( no redirect param name , no redirect param class ) ; if ( no redirect ) { final string js = json util to json string ( " location " , redirect u r l ) ; response = response ok ( js ) type ( media type application json ) build ( ) ; } else if ( has data ) { short permission = params get ( permission param name , permission param class ) ; short unmasked permission = params get ( unmasked permission param name , unmasked permission param class ) ; boolean override = params get ( overwrite param name , overwrite param class ) ; short replication = params get ( replication param name , replication param class ) ; long block size = params get ( block size param name , block size param class ) ; f s operations f s create command = new f s operations f s create ( is , path , permission , override , replication , block size , unmasked permission ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] permission [ { } ] override [ { } ] " + " replication [ { } ] block size [ { } ] unmaskedpermission [ { } ] " , new object [ ] { path , permission , override , replication , block size , unmasked permission } ) ; final string js = json util to json string ( " location " , uri info get absolute path ( ) ) ; response = response created ( uri info get absolute path ( ) ) type ( media type application json ) entity ( js ) build ( ) ; } else { response = response temporary redirect ( redirect u r l ) build ( ) ; } break ; } case allowsnapshot : { f s operations f s allow snapshot command = new f s operations f s allow snapshot ( path ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] allowed snapshot " , path ) ; response = response ok ( ) build ( ) ; break ; } case disallowsnapshot : { f s operations f s disallow snapshot command = new f s operations f s disallow snapshot ( path ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] disallowed snapshot " , path ) ; response = response ok ( ) build ( ) ; break ; } case createsnapshot : { string snapshot name = params get ( snapshot name param name , snapshot name param class ) ; f s operations f s create snapshot command = new f s operations f s create snapshot ( path , snapshot name ) ; string json = fs execute ( user , command ) ; audit log info ( " [ { } ] snapshot created as [ { } ] " , path , snapshot name ) ; response = response ok ( json ) type ( media type application json ) build ( ) ; break ; } case setxattr : { string xattr name = params get ( x attr name param name , x attr name param class ) ; string xattr value = params get ( x attr value param name , x attr value param class ) ; enum set < x attr set flag > flag = params get ( x attr set flag param name , x attr set flag param class ) ; f s operations f s set x attr command = new f s operations f s set x attr ( path , xattr name , xattr value , flag ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to x attr [ { } ] " , path , xattr name ) ; response = response ok ( ) build ( ) ; break ; } case renamesnapshot : { string old snapshot name = params get ( old snapshot name param name , old snapshot name param class ) ; string snapshot name = params get ( snapshot name param name , snapshot name param class ) ; f s operations f s rename snapshot command = new f s operations f s rename snapshot ( path , old snapshot name , snapshot name ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] renamed snapshot [ { } ] to [ { } ] " , path , old snapshot name , snapshot name ) ; response = response ok ( ) build ( ) ; break ; } case removexattr : { string xattr name = params get ( x attr name param name , x attr name param class ) ; f s operations f s remove x attr command = new f s operations f s remove x attr ( path , xattr name ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] removed x attr [ { } ] " , path , xattr name ) ; response = response ok ( ) build ( ) ; break ; } case mkdirs : { short permission = params get ( permission param name , permission param class ) ; short unmasked permission = params get ( unmasked permission param name , unmasked permission param class ) ; f s operations f s mkdirs command = new f s operations f s mkdirs ( path , permission , unmasked permission ) ; j s o n object json = fs execute ( user , command ) ; audit log info ( " [ { } ] permission [ { } ] unmaskedpermission [ { } ] " , path , permission , unmasked permission ) ; response = response ok ( json ) type ( media type application json ) build ( ) ; break ; } case rename : { string to path = params get ( destination param name , destination param class ) ; f s operations f s rename command = new f s operations f s rename ( path , to path ) ; j s o n object json = fs execute ( user , command ) ; audit log info ( " [ { } ] to [ { } ] " , path , to path ) ; response = response ok ( json ) type ( media type application json ) build ( ) ; break ; } case setowner : { string owner = params get ( owner param name , owner param class ) ; string group = params get ( group param name , group param class ) ; f s operations f s set owner command = new f s operations f s set owner ( path , owner , group ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to ( o / g ) [ { } ] " , path , owner + " : " + group ) ; response = response ok ( ) build ( ) ; break ; } case setpermission : { short permission = params get ( permission param name , permission param class ) ; f s operations f s set permission command = new f s operations f s set permission ( path , permission ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to [ { } ] " , path , permission ) ; response = response ok ( ) build ( ) ; break ; } case setreplication : { short replication = params get ( replication param name , replication param class ) ; f s operations f s set replication command = new f s operations f s set replication ( path , replication ) ; j s o n object json = fs execute ( user , command ) ; audit log info ( " [ { } ] to [ { } ] " , path , replication ) ; response = response ok ( json ) build ( ) ; break ; } case settimes : { long modified time = params get ( modified time param name , modified time param class ) ; long access time = params get ( access time param name , access time param class ) ; f s operations f s set times command = new f s operations f s set times ( path , modified time , access time ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to ( m / a ) [ { } ] " , path , modified time + " : " + access time ) ; response = response ok ( ) build ( ) ; break ; } case setacl : { string acl spec = params get ( acl permission param name , acl permission param class ) ; f s operations f s set acl command = new f s operations f s set acl ( path , acl spec ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to acl [ { } ] " , path , acl spec ) ; response = response ok ( ) build ( ) ; break ; } case removeacl : { f s operations f s remove acl command = new f s operations f s remove acl ( path ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] removed acl " , path ) ; response = response ok ( ) build ( ) ; break ; } case modifyaclentries : { string acl spec = params get ( acl permission param name , acl permission param class ) ; f s operations f s modify acl entries command = new f s operations f s modify acl entries ( path , acl spec ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] modify acl entry with [ { } ] " , path , acl spec ) ; response = response ok ( ) build ( ) ; break ; } case removeaclentries : { string acl spec = params get ( acl permission param name , acl permission param class ) ; f s operations f s remove acl entries command = new f s operations f s remove acl entries ( path , acl spec ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] remove acl entry [ { } ] " , path , acl spec ) ; response = response ok ( ) build ( ) ; break ; } case removedefaultacl : { f s operations f s remove default acl command = new f s operations f s remove default acl ( path ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] remove default acl " , path ) ; response = response ok ( ) build ( ) ; break ; } case setstoragepolicy : { string policy name = params get ( policy name param name , policy name param class ) ; f s operations f s set storage policy command = new f s operations f s set storage policy ( path , policy name ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to policy [ { } ] " , path , policy name ) ; response = response ok ( ) build ( ) ; break ; } case setecpolicy : { string policy name = params get ( e c policy param name , e c policy param class ) ; f s operations f s set erasure coding policy command = new f s operations f s set erasure coding policy ( path , policy name ) ; fs execute ( user , command ) ; audit log info ( " [ { } ] to policy [ { } ] " , path , policy name ) ; response = response ok ( ) build ( ) ; break ; } case satisfystoragepolicy : { f s operations f s satisy storage policy command = new f s operations f s satisy storage policy ( path ) ; fs execute ( user , command ) ; audit log info ( " satisfy storage policy for [ { } ] " , path ) ; response = response ok ( ) build ( ) ; break ; } default : { throw new i o exception ( message format format ( " invalid http put operation [ { 0 } ] " , op value ( ) ) ) ; } } return response ; }


gets a rule context that can be used to register actions and test that they are created correctly takes in a dummy target which will be used to configure the rule context ' s { @ link android configuration }

public rule context get rule context for action testing ( configured target dummy target ) throws exception { rule context dummy = get rule context ( dummy target ) ; extended event handler event handler = new stored event handler ( ) ; sky function environment skyframe env = skyframe executor get sky function environment for testing ( event handler ) ; starlark builtins value starlark builtins value = ( starlark builtins value ) preconditions check not null ( skyframe env get value ( starlark builtins value key ( ) ) ) ; caching analysis environment analysis env = new caching analysis environment ( view get artifact factory ( ) , skyframe executor get action key context ( ) , configured target key builder ( ) set label ( dummy target get label ( ) ) set configuration ( target config ) build ( ) , / * is system env = * / false , target config extended sanity checks ( ) , target config allow analysis failures ( ) , event handler , skyframe env , starlark builtins value ) ; return view get rule context for testing ( event handler , dummy target , analysis env , new build configuration collection ( immutable list of ( dummy get configuration ( ) ) , dummy get host configuration ( ) ) ) ; }


accepts a collection of possibly - null entries if { @ code same comparator } , then it is assumed that they do not need to be sorted or checked for dupes

private static < k , v > immutable sorted map < k , v > from entries ( comparator < ? super k > comparator , boolean same comparator , iterable < ? extends entry < ? extends k , ? extends v > > entries ) { / / " adding " type params to an array of a raw type should be safe as / / long as no one can ever cast that same array instance back to a / / raw type @ suppress warnings ( " unchecked " ) entry < k , v > [ ] entry array = ( entry [ ] ) iterables to array ( entries , empty entry array ) ; return from entries ( comparator , same comparator , entry array , entry array length ) ; }


this returns a copy of { @ link aggregator factories } modified so that calls to { @ link # create sub aggregators } will ignore the provided parent aggregator and always use { @ code fixed parent } provided in to this method { @ link adapting aggregator } uses this to make sure that sub - aggregators get the { @ link adapting aggregator } aggregator itself as the parent

public aggregator factories fix parent ( aggregator fixed parent ) { aggregator factories previous = this ; return new aggregator factories ( context , factories ) { @ override public aggregator [ ] create sub aggregators ( aggregator parent , cardinality upper bound cardinality ) throws i o exception { / / note that we ' re throwing out the " parent " passed in to this method and using the parent passed to fix parent return previous create sub aggregators ( fixed parent , cardinality ) ; } } ; }


encoding overhead is thrift type plus 32 - bit length prefix

@ override public int list size in bytes ( list < byte [ ] > values ) { int size in bytes = 5 ; for ( int i = 0 , length = values size ( ) ; i < length ; i + + ) { size in bytes + = values get ( i ) length ; } return size in bytes ; }


byte [ ] read bytes ( ) throws i o exception ;


constructs and returns a quota filter that matches all configured entities

public static client quota filter all ( ) { return new client quota filter ( collections empty list ( ) , false ) ; }


public api client add default header ( string key , string value ) { default header map put ( key , value ) ; return this ; }


return id that corresponds to the group generation that was active when the last join was successful

public int last completed generation id ( ) { return last completed generation id ; }


returns the variables after execution of the instruction at the given offset

public traced variables get variables after ( int instruction offset ) { return variables after [ instruction offset ] ; }


gets all the key - value pairs in the existing windows

key value iterator < bytes , byte [ ] > all ( ) ;


to test special tags to test special tags and operation id starting with number

public single < client > rx call 1 2 3test special tags ( client body , api client auth info auth info ) { return single create ( new io vertx rx java single on subscribe adapter < > ( fut - > delegate call 1 2 3test special tags ( body , auth info , fut ) ) ) ; }


cancel an existing delegation { @ link token }

public cancel delegation token response cancel delegation token ( cancel delegation token request request ) throws yarn exception , i o exception ;


returns true if the handshake is complete

public boolean is finished ( ) { / / if we have a handshake result , we are done if ( result ! = null ) { return true ; } / / if we have an error status , we are done if ( status ! = null & & status get code ( ) ! = status code ok value ( ) ) { return true ; } return false ; }


write the json as bytes - then close the file

private void write json as bytes ( t instance , output stream data output stream ) throws i o exception { try { string json = to json ( instance ) ; byte [ ] b = json get bytes ( standard charsets utf 8 ) ; data output stream write ( b ) ; data output stream flush ( ) ; data output stream close ( ) ; } finally { i o utils close stream ( data output stream ) ; } }


returns true if field corresponding to field i d is set ( has been assigned a value ) and false otherwise

public boolean is set ( fields field ) { if ( field = = null ) { throw new illegal argument exception ( ) ; } switch ( field ) { case e : return is set e ( ) ; case ite : return is set ite ( ) ; } throw new illegal state exception ( ) ; }


it is important to include daynight in the cache key so that if it changes , the cache won ' t return an animation from the wrong bucket

private static boolean is night mode ( context context ) { int night mode masked = context get resources ( ) get configuration ( ) ui mode & configuration ui mode night mask ; return night mode masked = = configuration ui mode night yes ; }


figures out the charset from the content - type header

private string get charset ( u r l connection con ) { for ( string t : con get content type ( ) split ( " ; " ) ) { t = t trim ( ) to lower case ( locale english ) ; if ( t starts with ( " charset = " ) ) return t substring ( 8 ) ; } / / couldn ' t find it html spec says default is us - ascii , / / but utf - 8 is a better choice since / / ( 1 ) it ' s compatible with us - ascii / / ( 2 ) a well - written web applications tend to use utf - 8 return " utf - 8 " ; }


public void set blob ( int parameter index , blob x ) throws s q l exception { }


checks whether the metadata version supports writing { @ link shard generations } to the repository

public static boolean use shard generations ( version repository meta version ) { return repository meta version on or after ( shard gen in repo data version ) ; }


frees any memory allocated native way operation is irreversible after this call , nothing will be drawn this method is idempotent , subsequent calls have no effect like { @ link android graphics bitmap # recycle ( ) } this is an advanced call and is invoked implicitly by finalizer

public void recycle ( ) { shutdown ( ) ; m buffer recycle ( ) ; }


sets the fully qualified ( service and method ) method name

public builder < req t , resp t > set full method name ( string full method name ) { this full method name = full method name ; return this ; }


get all of the web addresses of the individual n ns in a given nameservice

public static map < string , inet socket address > get web addresses for nameservice id ( configuration conf , string ns id , string default value ) { return d f s util client get addresses for nameservice id ( conf , ns id , default value , d f s config keys dfs namenode http address key ) ; }


sets the { @ link key selector key selectors } that must be used for partitioning keyed state of this transformation

public void set state key selectors ( key selector < in1 , ? > state key selector 1 , key selector < in2 , ? > state key selector 2 ) { this state key selector 1 = state key selector 1 ; this state key selector 2 = state key selector 2 ; update managed memory state backend use case ( state key selector 1 ! = null | | state key selector 2 ! = null ) ; }


subtype to provide { @ link run # get number ( ) } so that this class doesn ' t have to depend on it

protected abstract int get number of ( r r ) ;


test of local header at method , of class zip in

public void test local header at ( ) throws exception { int count = entry count ; string filename = " test jar " ; zip file builder builder = new zip file builder ( ) ; for ( int i = 0 ; i < count ; i + + ) { builder add ( " pkg / f " + i + " class " , " all day long " ) ; } builder create ( filename ) ; final zip in zip in = new zip in ( filename ) ; zip in central directory ( ) ; list < directory entry > list = zip in central directory ( ) list ( ) ; count = 0 ; string name ; local file header header ; for ( directory entry dir entry : list ) { name = " pkg / f " + count + " class " ; header = zip in local header at ( dir entry get ( cenoff ) ) ; assert that ( dir entry get filename ( ) ) is equal to ( name ) ; assert that ( header get filename ( ) ) is equal to ( name ) ; count + + ; } }


produces a cache suitable for storing test keys

static trimmed configuration cache < test key , string , immutable map < string , string > > new cache ( ) { return new trimmed configuration cache < > ( test key : : descriptor , test key : : configuration , test key : : compare configurations ) ; }


public class < ? > get serialization view ( ) { return this serialization view ; }


test sending to a destination using the method send ( destination d , message creator message creator )

void test send destination ( ) throws exception { do test send destination ( true , false , true , false ) ; }


public long get pet id ( ) { return pet id ; }


public integer get prefix ns integer ( ) { return prefix ns integer ; }


shuts the given { @ link rpc endpoint rpc endpoints } down and waits for their termination

public static void terminate rpc endpoints ( time timeout , rpc endpoint rpc endpoints ) throws interrupted exception , execution exception , timeout exception { terminate async closeables ( arrays as list ( rpc endpoints ) , timeout ) ; }


return the { @ link cache manager } that this instance uses

public cache manager get cache manager ( ) { assert state ( this cache manager ! = null , " no cache manager set " ) ; return this cache manager ; }


frees the specified objects from the { @ link # get ( class ) pool } null objects within the array are silently ignored

static public void free all ( array objects , boolean same pool ) { if ( objects = = null ) throw new illegal argument exception ( " objects cannot be null " ) ; pool pool = null ; for ( int i = 0 , n = objects size ; i < n ; i + + ) { object object = objects get ( i ) ; if ( object = = null ) continue ; if ( pool = = null ) { pool = type pools get ( object get class ( ) ) ; if ( pool = = null ) continue ; / / ignore freeing an object that was never retained } pool free ( object ) ; if ( ! same pool ) pool = null ; } }


protected void cleanup registry ( ) { if ( this registry client ! = null ) { this registry client clean all applications ( ) ; } }


date to long conversion handles null dates that can be returned by aws by returning 0

public static long date to long ( final date date ) { if ( date = = null ) { return 0l ; } return date get time ( ) ; }


public void get pet by id test ( test context test context ) { async async = test context async ( ) ; long pet id = null ; api get pet by id ( pet id , result - > { / / todo : test validations async complete ( ) ; } ) ; }


return the default value of the property

public string to default value ( schema p ) { / / if a variable has no default set and only has one allowed value / / using enum of length = = 1 we use that value server / client usage : / / python servers : should only use default values for optional params / / python clients : should only use default values for required params object default object = null ; boolean enum length one = ( p get enum ( ) ! = null & & p get enum ( ) size ( ) = = 1 ) ; if ( p get default ( ) ! = null ) { default object = p get default ( ) ; } else if ( enum length one ) { default object = p get enum ( ) get ( 0 ) ; } if ( default object = = null ) { return null ; } string default value = default object to string ( ) ; if ( model utils is date schema ( p ) ) { default value = python date ( default object ) ; } else if ( model utils is date time schema ( p ) ) { default value = python date time ( default object ) ; } else if ( model utils is string schema ( p ) & & ! model utils is byte array schema ( p ) & & ! model utils is binary schema ( p ) & & ! model utils is file schema ( p ) & & ! model utils is u u i d schema ( p ) & & ! model utils is email schema ( p ) ) { default value = ensure quotes ( default value ) ; } else if ( model utils is boolean schema ( p ) ) { if ( boolean value of ( default value ) = = false ) { default value = " false " ; } else { default value = " true " ; } } return default value ; }


specify the desired size for the jms session cache ( per jms session type ) this cache size is the maximum limit for the number of cached sessions per session acknowledgement type ( auto , client , dups ok , transacted ) as a consequence , the actual number of cached sessions may be up to four times as high as the specified value - in the unlikely case of mixing and matching different acknowledgement types default is 1 : caching a single session , ( re - ) creating further ones on demand specify a number like 10 if you ' d like to raise the number of cached sessions ; that said , 1 may be sufficient for low - concurrency scenarios

public void set session cache size ( int session cache size ) { assert is true ( session cache size > = 1 , " session cache size must be 1 or higher " ) ; this session cache size = session cache size ; }


processes the manifest for a binary and return the manifest path

public path process manifest ( string application id , int version code , string version name , path manifest , path processed manifest , boolean log warnings ) { if ( version code ! = - 1 | | version name ! = null | | application id ! = null ) { process manifest ( version code , version name , manifest , processed manifest , merge type application , application id , log warnings ) ; return processed manifest ; } return manifest ; }


this test validates the correctness of get apps in case the cluster is composed of only 1 bad sub cluster and a good one

public void test get apps one bad one good ( ) throws yarn exception , i o exception , interrupted exception { setup cluster ( arrays as list ( good , bad 2 ) ) ; apps info response = interceptor get apps ( null , null , null , null , null , null , null , null , null , null , null , null , null , null , null ) ; assert assert not null ( response ) ; assert assert equals ( 1 , response get apps ( ) size ( ) ) ; }


returns the current text displayed in the field

public string get text ( ) { return text field get text ( ) ; }


public enum string enum get enum string ( ) { return enum string ; }


gets the address set of this address map

public address set view get address set ( ) ;


returns the number of entries in the module reference table

short get module reference table count ( ) { return ne cmod ; }


public string to string ( ) { return " hayes modem " ; }


public csv file line ( string line ) { out write ( line ) ; out write ( eol ) ; return this ; }


return if the given field is allowed for binding invoked for each passed - in property value the default implementation checks for " xxx " , " xxx " and " xxx " matches , as well as direct equality , in the specified lists of allowed fields and disallowed fields a field matching a disallowed pattern will not be accepted even if it also happens to match a pattern in the allowed list can be overridden in subclasses

protected boolean is allowed ( string field ) { string [ ] allowed = get allowed fields ( ) ; string [ ] disallowed = get disallowed fields ( ) ; return ( ( object utils is empty ( allowed ) | | pattern match utils simple match ( allowed , field ) ) & & ( object utils is empty ( disallowed ) | | ! pattern match utils simple match ( disallowed , field ) ) ) ; }


tests that a service manager can be fully shut down if one of its failure listeners is slow or even permanently blocked

public void test listener deadlock ( ) throws interrupted exception { final count down latch fail enter = new count down latch ( 1 ) ; final count down latch fail leave = new count down latch ( 1 ) ; final count down latch after started = new count down latch ( 1 ) ; service fail run service = new abstract service ( ) { @ override protected void do start ( ) { new thread ( ) { @ override public void run ( ) { notify started ( ) ; / / we need to wait for the main thread to leave the service manager start async call / / to / / ensure that the thread running the failure callbacks is not the main thread uninterruptibles await uninterruptibly ( after started ) ; notify failed ( new exception ( " boom " ) ) ; } } start ( ) ; } @ override protected void do stop ( ) { notify stopped ( ) ; } } ; final service manager manager = new service manager ( arrays as list ( fail run service , new no op service ( ) ) ) ; manager add listener ( new service manager listener ( ) { @ override public void failure ( service service ) { fail enter count down ( ) ; / / block until after the service manager is shutdown uninterruptibles await uninterruptibly ( fail leave ) ; } } , direct executor ( ) ) ; manager start async ( ) ; after started count down ( ) ; / / we do not call await healthy because , due to races , that method may throw an exception but / / we really just want to wait for the thread to be in the failure callback so we wait for that / / explicitly instead fail enter await ( ) ; assert false ( " state should be updated before calling listeners " , manager is healthy ( ) ) ; / / now we want to stop the services thread stopping thread = new thread ( ) { @ override public void run ( ) { manager stop async ( ) await stopped ( ) ; } } ; stopping thread start ( ) ; / / this should be super fast since the only non stopped service is a no op service stopping thread join ( 1000 ) ; assert false ( " stop async has deadlocked ! " , stopping thread is alive ( ) ) ; fail leave count down ( ) ; / / release the background thread }


sets the maximum number of retry attempts that may be configured by the service config if the service config specifies a larger value it will be reduced to this value setting this number to zero is not effectively the same as { @ code disable retry ( ) } because the former does not disable < a href = " https : github comgrpcproposalblobmaster a 6 - client - retries md # transparent - retries " > transparent retry this method may not work as expected for the current release because retry is not fully implemented yet

public t max retry attempts ( int max retry attempts ) { throw new unsupported operation exception ( ) ; }


configure a base url to prepend uri templates with the base url must have a scheme and host but may optionally contain a port and a path the base url must be fully expanded and encoded which can be done via { @ link uri components builder }

public void set base url ( @ nullable string base url ) { if ( base url ! = null ) { uri components uri components = uri components builder from uri string ( base url ) build ( ) ; assert has text ( uri components get scheme ( ) , " ' base url ' must have a scheme " ) ; assert has text ( uri components get host ( ) , " ' base url ' must have a host " ) ; assert is null ( uri components get query ( ) , " ' base url ' cannot have a query " ) ; assert is null ( uri components get fragment ( ) , " ' base url ' cannot have a fragment " ) ; } this base url = base url ; }


sets a new data renderer object for the chart

public void set renderer ( data renderer renderer ) { if ( renderer ! = null ) m renderer = renderer ; }


fills the complete bitmap with the currently set color

public void fill ( ) { ensure canvas exists ( ) ; context clear rect ( 0 , 0 , get width ( ) , get height ( ) ) ; rectangle ( 0 , 0 , get width ( ) , get height ( ) , draw type fill ) ; }


iterates over the specified area of this buffer with the specified { @ code processor } in descending order ( i e { @ code ( index + length - 1 ) } , { @ code ( index + length - 2 ) } , { @ code index } )

public abstract int for each byte desc ( int index , int length , byte processor processor ) ;


void set artificial slowdown ( long period ) { this artificial slowdown = period ; }


public list < integer > get prefix wrapped array ( ) { return prefix wrapped array ; }


append a new record at the next sequential offset

public long append ( long timestamp , byte [ ] key , byte [ ] value ) { return append ( timestamp , wrap nullable ( key ) , wrap nullable ( value ) , record empty headers ) ; }


creation of the label mgr plugin actions

private void setup actions ( ) { docking action add label action = new add label action ( this ) ; tool add action ( add label action ) ; / / add the plugin action docking action edit label action = new edit label action ( this ) ; tool add action ( edit label action ) ; docking action edit external label action = new edit external label action ( this ) ; tool add action ( edit external label action ) ; docking action remove label action = new remove label action ( this ) ; tool add action ( remove label action ) ; / / add the plugin action docking action set operand label action = new set operand label action ( this ) ; tool add action ( set operand label action ) ; / / add the plugin action docking action label history action = new label history action ( tool , get name ( ) ) ; tool add action ( label history action ) ; / / create the show all history action docking action all history action = new all history action ( tool , get name ( ) ) ; tool add action ( all history action ) ; }


join an array of strings with the given separator note : this might be replaced by utility method from commons - lang or guava someday if one of those libraries is added as dependency

public static string join ( string [ ] array , string separator ) { int len = array length ; if ( len = = 0 ) { return " " ; } string builder out = new string builder ( ) ; out append ( array [ 0 ] ) ; for ( int i = 1 ; i < len ; i + + ) { out append ( separator ) append ( array [ i ] ) ; } return out to string ( ) ; }


makes sure { @ link remote launcher } properly masks arguments

public void slave mask ( ) throws exception { argument list builder args = new argument list builder ( ) ; args add ( " java " ) ; args add masked ( " - version " ) ; slave s = j create online slave ( ) ; j show agent logs ( s , logging ) ; string writer out = new string writer ( ) ; assert equals ( 0 , s create launcher ( new stream task listener ( out ) ) launch ( ) cmds ( args ) join ( ) ) ; assert that ( out to string ( ) , contains string ( " $ java * * * * * * * * " ) ) ; }


short - circuit ? : no threadsemaphore : semaphore semaphore permit reached ? : no execution result : success

public void test execution hook semaphore success ( ) { assert hooks on success ( new func 0 < c > ( ) { @ override public c call ( ) { return get command ( execution isolation strategy semaphore , execution result success , fallback result success ) ; } } , new action 1 < c > ( ) { @ override public void call ( c command ) { testable execution hook hook = command get builder ( ) execution hook ; assert true ( hook command emissions match ( 1 , 0 , 1 ) ) ; assert true ( hook execution events match ( 1 , 0 , 1 ) ) ; assert true ( hook fallback events match ( 0 , 0 , 0 ) ) ; assert equals ( " on start - ! on run start - on execution start - on execution emit - ! on run success - ! on complete - on emit - on execution success - on success - " , hook execution sequence to string ( ) ) ; } } ) ; }


encodes the specified cookies into a single cookie header value

public string encode ( iterable < ? extends cookie > cookies ) { iterator < ? extends cookie > cookies it = check not null ( cookies , " cookies " ) iterator ( ) ; if ( ! cookies it has next ( ) ) { return null ; } string builder buf = string builder ( ) ; if ( strict ) { cookie first cookie = cookies it next ( ) ; if ( ! cookies it has next ( ) ) { encode ( buf , first cookie ) ; } else { list < cookie > cookies list = internal thread local map get ( ) array list ( ) ; cookies list add ( first cookie ) ; while ( cookies it has next ( ) ) { cookies list add ( cookies it next ( ) ) ; } cookie [ ] cookies sorted = cookies list to array ( new cookie [ 0 ] ) ; arrays sort ( cookies sorted , cookie comparator ) ; for ( cookie c : cookies sorted ) { encode ( buf , c ) ; } } } else { while ( cookies it has next ( ) ) { encode ( buf , cookies it next ( ) ) ; } } return strip trailing separator or null ( buf ) ; }


find the fields constant that matches name , or null if its not found

public static fields find by name ( string name ) { return by name get ( name ) ; }


check for a pause ( e g gc ) since the last time { @ link # restart quorum stop watch ( ) } was called if detected , return the length of the pause ; else , - 1

private long get quorum timeout increase millis ( long offset , int millis ) { long elapsed = quorum stop watch now ( time unit milliseconds ) ; long pause time = elapsed + offset ; if ( pause time > ( millis * wait progress info threshold ) ) { quorum journal manager log info ( " pause detected while waiting for " + " quorum call response ; increasing timeout threshold by pause time " + " of " + pause time + " ms " ) ; return pause time ; } else { return - 1 ; } }


public list < duration stats > get operation statistics ( ) { return store get operation statistics ( ) ; }


determine if values from the given annotation can be safely accessed without causing any { @ link type not present exception type not present exceptions }

boolean is valid ( annotation annotation ) { assert annotation ( annotation ) ; for ( int i = 0 ; i < size ( ) ; i + + ) { if ( can throw type not present exception ( i ) ) { try { get ( i ) invoke ( annotation ) ; } catch ( throwable ex ) { return false ; } } } return true ; }


create an empty record for the specified key

public d b record create record ( long key ) { return create record ( new long field ( key ) ) ; }


in a parallel test run there is more than one thread doing the execution

public boolean is parallel ( ) { return num threads > 1 ; }


get a loggable stack trace from a throwable

private static string get stack trace string ( @ nullable throwable tr ) { if ( tr = = null ) { return " " ; } final string writer sw = new string writer ( ) ; final print writer pw = new print writer ( sw ) ; tr print stack trace ( pw ) ; return sw to string ( ) ; }


public void direct map test ( ) { / / todo : test direct map }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


public boolean wants params moved high ( ) { return true ; }


creates and returns a test suite containing the tests from the given classes andor packages which matched the given tags

public set < class < ? > > create ( ) { set < class < ? > > result = new linked hash set < > ( ) ; for ( class < ? > test class : iterables filter ( test classes , match class predicate ) ) { result add ( test class ) ; } if ( tolerate empty test suites & & result is empty ( ) ) { / / we have some cases where the resulting test suite is empty , which some of our test / / infrastructure treats as an error result add ( tautology test class ) ; } return result ; }


public void on add branch test ( global session global session , branch session branch session ) throws exception { for ( session manager session manager : session manager list ) { session manager on begin ( global session ) ; session manager on add branch ( global session , branch session ) ; session manager on end ( global session ) ; } }


roll a new version of the given key generating the material for it this implementation generates the key material and calls the { @ link # roll new version ( string , byte [ ] ) } method

public key version roll new version ( string name ) throws no such algorithm exception , i o exception { metadata meta = get metadata ( name ) ; if ( meta = = null ) { throw new i o exception ( " can ' t find metadata for key " + name ) ; } byte [ ] material = generate key ( meta get bit length ( ) , meta get cipher ( ) ) ; return roll new version ( name , material ) ; }


gets the view node for the given path this is useful to translate to a tree path that is valid for the currently displayed tree ( remember that if the tree is filtered , then the displayed nodes are clones of the model nodes )

public g tree node get view node for path ( tree path path ) { return get node for path ( get view root ( ) , path ) ; }


gets all servers that exist in the process

public void get servers ( io grpc channelz v 1 get servers request request , io grpc stub stream observer < io grpc channelz v 1 get servers response > response observer ) { io grpc stub server calls async unimplemented unary call ( get get servers method ( ) , response observer ) ; }


verifies that a factory configuration is correctly parsed

public void test factory parsing ( ) throws exception { final configuration config = new configuration ( ) ; config set string ( config constants metrics reporter prefix + " test " + config constants metrics reporter factory class suffix , test reporter factory class get name ( ) ) ; final list < reporter setup > reporter setups = reporter setup from configuration ( config , null ) ; assert equals ( 1 , reporter setups size ( ) ) ; final reporter setup reporter setup = reporter setups get ( 0 ) ; assert equals ( test reporter factory reporter , reporter setup get reporter ( ) ) ; }


returns whether the given configured target has errors

public boolean has errors ( configured target configured target ) { return configured target = = null ; }


default mono < response entity < void > > add pet ( @ api param ( value = " pet object that needs to be added to the store " , required = true ) @ valid @ request body mono < pet > body , @ api ignore final server web exchange exchange ) { return get delegate ( ) add pet ( body , exchange ) ; }


patch fake : to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

default response entity < client > test client model ( @ api param ( value = " client model " , required = true ) @ valid @ request body client body ) { return get delegate ( ) test client model ( body ) ; }


returns true if this graph allows self - loops ( edges that connect a node to itself ) attempting to add a self - loop to a graph that does not allow them will throw an { @ link illegal argument exception }


returns the metric group for the parallel subtask of the source that runs this { @ link serialization schema } instances of this class can be used to register new metrics with flink and to create a nested hierarchy based on the group names see { @ link metric group } for more information for the metrics system


public void set previous offset ( int offset ) { / / intentionally left empty }


add a sample value to be considered by the format finder if { @ code require full match } was set to < code > true < code > on construction then the entire sample will be tested to see if it is a timestamp , otherwise a timestamp may be detected as just a portion of the sample an exception will be thrown if { @ code error on no timestamp } was set to < code > true < code > on construction , and no timestamp is found an exception will also be thrown if { @ code error on multiple patterns } was set to < code > true < code > on construction and a new timestamp format is detected that cannot be merged with a previously detected format

public void add sample ( string text ) { bit set number pos bit set = require full match ? null : string to number pos bit set ( text ) ; for ( candidate timestamp format candidate : ordered candidate formats ) { timestamp match match = check candidate ( candidate , text , number pos bit set , require full match , timeout checker ) ; if ( match ! = null ) { timestamp format new format = match timestamp format ; boolean must add = true ; for ( int i = 0 ; i < matched formats size ( ) ; + + i ) { timestamp format existing format = matched formats get ( i ) ; if ( existing format can merge with ( new format ) ) { matched formats set ( i , existing format merge with ( new format ) ) ; must add = false ; / / sharing formats considerably reduces the memory usage during the analysis / / when there are many samples , so reconstruct the match with a shared format match = new timestamp match ( match , matched formats get ( i ) ) ; break ; } } if ( must add ) { if ( error on multiple patterns & & matched formats is empty ( ) = = false ) { throw new illegal argument exception ( " multiple timestamp formats found [ " + matched formats get ( 0 ) + " ] and [ " + new format + " ] " ) ; } matched formats add ( new format ) ; } matches add ( match ) ; cached java timestamp formats = null ; return ; } } if ( error on no timestamp ) { throw new illegal argument exception ( " no timestamp found in [ " + text + " ] " ) ; } }


serialize the given java object into request body according to the object ' s class and the request content - type

public request body serialize ( object obj , string content type ) throws api exception { if ( obj instanceof byte [ ] ) { / / binary ( byte array ) body parameter support return request body create ( media type parse ( content type ) , ( byte [ ] ) obj ) ; } else if ( obj instanceof file ) { / / file body parameter support return request body create ( media type parse ( content type ) , ( file ) obj ) ; } else if ( is json mime ( content type ) ) { string content ; if ( obj ! = null ) { content = json serialize ( obj ) ; } else { content = null ; } return request body create ( media type parse ( content type ) , content ) ; } else { throw new api exception ( " content type \ " " + content type + " \ " is not supported " ) ; } }


encodes the provided data as a hexadecimal string

public static string encode ( byte [ ] data , int offset , int length ) { string builder result = new string builder ( length * 2 ) ; for ( int i = 0 ; i < length ; i + + ) { byte b = data [ offset + i ] ; result append ( hex digits [ ( b > > > 4 ) & 0x 0f ] ) ; result append ( hex digits [ b & 0x 0f ] ) ; } return result to string ( ) ; }


return whether the underlying method is overridable , i e not marked as static , final or private


this function maps the required fields from data node info to disk balancer data node

private disk balancer data node get balancer node from data node ( datanode info node info ) { preconditions check not null ( node info ) ; disk balancer data node db data node = new disk balancer data node ( node info get datanode uuid ( ) ) ; db data node set data node i p ( node info get ip addr ( ) ) ; db data node set data node name ( node info get host name ( ) ) ; db data node set data node port ( node info get ipc port ( ) ) ; return db data node ; }


reads row count and sets value in status label

private long read row count ( d b r progress monitor monitor ) throws d b exception { final d b c execution context execution context = get execution context ( ) ; d b s data container data container = get data container ( ) ; if ( execution context = = null | | data container = = null ) { throw new d b exception ( model messages error not connected to database ) ; } long [ ] result = new long [ 1 ] ; d b exec utils try execute recover ( monitor , execution context get data source ( ) , param - > { try ( d b c session session = execution context open session ( monitor , d b c execution purpose user , " read total row count " ) ) { long row count = data container count data ( new abstract execution source ( data container , execution context , this ) , session , model get data filter ( ) , d b s data container flag none ) ; model set total row count ( row count ) ; result [ 0 ] = row count ; } catch ( d b c exception e ) { throw new invocation target exception ( e ) ; } } ) ; return result [ 0 ] ; }


builder method for execution id parameter

public builder with execution id ( string execution id ) { this execution id = execution id ; return this ; }


{ @ inherit doc } the ddb implementation sorts all the paths such that new items are ordered highest level entry first ; deleted items are ordered lowest entry first this is to ensure that if a client failed partway through the update , there will no entries in the table which lack parent entries

public void move ( @ nullable collection < path > paths to delete , @ nullable collection < path metadata > paths to create , @ nullable final bulk operation state operation state ) throws i o exception { if ( paths to delete = = null & & paths to create = = null ) { return ; } log debug ( " moving paths of table { } in region { } : { } paths to delete and { } " + " paths to create " , table name , region , paths to delete = = null ? 0 : paths to delete size ( ) , paths to create = = null ? 0 : paths to create size ( ) ) ; log trace ( " move : paths to delete = { } , paths to create = { } " , paths to delete , paths to create ) ; / / in dynamo d b metadata store implementation , we assume that if a path / / exists , all its ancestors will also exist in the table / / following code is to maintain this invariant by putting all ancestor / / directories of the paths to create / / ancestor paths that are not explicitly added to paths to create ancestor state ancestor state = extract or create ( operation state , bulk operation state operation type rename ) ; list < d d b path metadata > new items = new array list < > ( ) ; if ( paths to create ! = null ) { / / create all parent entries / / this is synchronized on the move state so that across both serialized / / and parallelized renames , duplicate ancestor entries are not created synchronized ( ancestor state ) { new items add all ( complete ancestry ( path meta to d d b path meta ( paths to create ) , ancestor state ) ) ; } } / / sort all the new items topmost first new items sort ( path order comparators topmost pm first ) ; / / now process the deletions if ( paths to delete ! = null ) { list < d d b path metadata > tombstones = new array list < > ( paths to delete size ( ) ) ; for ( path meta : paths to delete ) { preconditions check argument ( ttl time provider ! = null , " ttl time provider " + " must not be null " ) ; final path metadata pm tombstone = path metadata tombstone ( meta , ttl time provider get now ( ) ) ; tombstones add ( new d d b path metadata ( pm tombstone ) ) ; } / / sort all the tombstones lowest first tombstones sort ( topmost pm last ) ; new items add all ( tombstones ) ; } process batch write request ( ancestor state , null , path metadata to item ( new items ) ) ; }


returns true if this manager contains the given provider

public boolean contains provider ( component provider provider ) { return placeholder manager contains provider ( provider ) ; }


initialize the bodies , anchors , axis , and reference angle using the world anchor and world axis

public void initialize ( body body a , body body b , vector 2 anchor ) { this body a = body a ; this body b = body b ; local anchor a set ( body a get local point ( anchor ) ) ; local anchor b set ( body b get local point ( anchor ) ) ; }


parse the given locale value as coming from a request parameter the default implementation calls { @ link string utils # parse locale ( string ) } , accepting the { @ link locale # to string } format as well as bcp 47 language tags

protected locale parse locale value ( string locale value ) { return string utils parse locale ( locale value ) ; }


public string get status ( ) { return datum get job status ( ) to string ( ) ; }


invoked once immediately after construction


a helper method that wraps the { @ code future # get } call and rethrows any thrown exception as a streams exception

public static map < topic partition , list offsets result info > get end offsets ( final kafka future < map < topic partition , list offsets result info > > end offsets future ) { try { return end offsets future get ( ) ; } catch ( final runtime exception | interrupted exception | execution exception e ) { log warn ( " the list offsets request failed " , e ) ; throw new streams exception ( " unable to obtain end offsets from kafka " , e ) ; } }


finds the button with the indicated text that is a sub - component of the indicated container , and then programmatically presses the button < br > the following is a sample j unit test use : < pre > env show tool ( ) ; option dialog dialog = ( option dialog ) env wait for dialog ( option dialog class , 1000 ) ; assert not null ( dialog ) ; press button by text ( dialog , " ok " ) ; < pre >

public static void press button by text ( dialog component provider provider , string button text ) { press button by text ( provider get component ( ) , button text , true ) ; }


converts a js array string to string [ ]

public static string [ ] to string array ( js array string js array string ) { string [ ] strings = new string [ js array string length ( ) ] ; for ( int i = 0 ; i < js array string length ( ) ; i + + ) { strings [ i ] = js array string get ( i ) ; } return strings ; }


generate the next name for the given name , i e append " 2 " to the base name if not ending with a number , otherwise increase the number by 1 for example : status = > status 2 status 2 = > status 3 my name 1 0 0 = > my name 1 0 1

private static string generate next name ( string name ) { pattern pattern = pattern compile ( " \ \ d + \ \ z " ) ; matcher matcher = pattern matcher ( name ) ; if ( matcher find ( ) ) { string num str = matcher group ( ) ; int num = integer parse int ( num str ) + 1 ; return name substring ( 0 , name length ( ) - num str length ( ) ) + num ; } else { return name + " 2 " ; } }


abstract template method for unmarshalling from a given stax { @ code x m l event reader }

protected abstract object unmarshal xml event reader ( x m l event reader event reader ) throws xml mapping exception ;


return a " mock " controller instance when an { @ code @ request mapping } method on the controller is invoked , the supplied argument values are remembered and the result can then be used to create a { @ code uri components builder } via { @ link # from method call ( object ) } note that this is a shorthand version of { @ link # controller ( class ) } intended for inline use ( with a static import ) , for example : < pre class = " code " > mvc uri components builder from method call ( on ( foo controller class ) get foo ( 1 ) ) build ( ) ; note : this method extracts values from " forwarded " and " x - forwarded - " headers if found see class - level docs

public static < t > t on ( class < t > controller type ) { return controller ( controller type ) ; }


returns the previous ' not aborted ' build ( i e ignores aborted and not built builds ) or null

private static run < ? , ? > get previous non aborted build ( run < ? , ? > build ) { run < ? , ? > previous build = build get previous build ( ) ; while ( previous build ! = null ) { if ( previous build get result ( ) = = null | | previous build get result ( ) = = result aborted | | previous build get result ( ) = = result not built ) { previous build = previous build get previous build ( ) ; } else { return previous build ; } } return previous build ; }


returns a new { @ link execution transition factory } for the given { @ link com google devtools build lib packages exec group }

public static execution transition factory create ( string exec group ) { return new execution transition factory ( exec group ) ; }


validates that the method call happens in the rpc endpoint ' s main thread < b > important : < b > this check only happens when assertions are enabled , such as when running tests this can be used for additional checks , like { @ code protected void concurrency critical method ( ) { validate runs in main thread ( ) ; some critical stuff } }

public void validate runs in main thread ( ) { assert main thread validator util is running in expected thread ( current main thread get ( ) ) ; }


gets a snapshot of the request properties

public synchronized map < string , string > get snapshot ( ) { if ( request properties snapshot = = null ) { request properties snapshot = collections unmodifiable map ( new hash map < > ( request properties ) ) ; } return request properties snapshot ; }


validates longitude value is within standard + - 180 coordinate bounds

protected void check longitude ( double longitude ) { if ( double is na n ( longitude ) | | longitude < min lon incl | | longitude > max lon incl ) { throw new illegal argument exception ( " invalid longitude " + longitude + " ; must be between " + min lon incl + " and " + max lon incl ) ; } }


create user this can only be done by the logged in user

public void create user test ( ) throws api exception { user body = null ; api create user ( body ) ; / / todo : test validations }


calls { @ link renderable provider # get renderables ( array , pool ) } and adds all returned { @ link renderable } instances to the current batch to be rendered any shaders set on the returned renderables will be replaced with the given { @ link shader } can only be called after a call to { @ link # begin ( camera ) } and before a call to { @ link # end ( ) }

public void render ( final renderable provider renderable provider , final shader shader ) { final int offset = renderables size ; renderable provider get renderables ( renderables , renderables pool ) ; for ( int i = offset ; i < renderables size ; i + + ) { renderable renderable = renderables get ( i ) ; renderable shader = shader ; renderable shader = shader provider get shader ( renderable ) ; } }


public < t > list < future < t > > invoke all ( collection < ? extends callable < t > > tasks , long timeout , time unit unit ) throws interrupted exception { submitted mark ( tasks size ( ) ) ; collection < ? extends callable < t > > instrumented = instrument ( tasks ) ; return delegate invoke all ( instrumented , timeout , unit ) ; }


returns the non - function namespace with the given name contained inside the specified parent namespace pass < code > null < code > for namespace to indicate the global namespace

public final namespace get namespace ( namespace parent , string namespace name ) { return current program get symbol table ( ) get namespace ( namespace name , parent ) ; }


public map < string , map < string , string > > get map map of string ( ) { return map map of string ; }


increments the ref count of this store instance ref counts are used to determine when a store can be closed safely , i e as soon as there are no more references be sure to always call a corresponding { @ link # dec ref } , in a finally clause ; otherwise the store may never be closed note that { @ link # close } simply calls dec ref ( ) , which means that the store will not really be closed until { @ link # dec ref } has been called for all outstanding references note : close can safely be called multiple times

public final void inc ref ( ) { ref counter inc ref ( ) ; }


invokes { @ code lock } { @ link lock # try lock ( long , time unit ) try lock ( timeout , unit ) } uninterruptibly

public static boolean try lock uninterruptibly ( lock lock , duration timeout ) { return try lock uninterruptibly ( lock , to nanos saturated ( timeout ) , time unit nanoseconds ) ; }


true if we are contributing to a span started by another tracer ( ex on a different host ) defaults to null when set , it is expected for { @ link # kind ( ) } to be { @ link kind # server } when an rpc trace is client - originated , it will be sampled and the same span id is used for the server side however , the server shouldn ' t set span timestamp or duration since it didn ' t start the span

@ nullable public boolean shared ( ) { return ( flags & flag shared set ) = = flag shared set ? ( flags & flag shared ) = = flag shared : null ; }


return true if this additional properties integer object is equal to o

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } additional properties integer additional properties integer = ( additional properties integer ) o ; return objects equals ( this name , additional properties integer name ) & & objects equals ( this additional properties , additional properties integer additional properties ) & & super equals ( o ) ; }


calls { @ link auto closeable # close ( ) } on the closable provided in { @ link auto closeable manager # auto closeable manager ( auto closeable ) }

public void stop ( ) throws exception { this auto closeable close ( ) ; }


finds the largest declared field number in the supplied protobuf class

static int get max declared field number ( class < ? extends message lite > protobuf class ) { return stream of ( protobuf class get fields ( ) ) filter ( f - > f get type ( ) = = int class ) map to int ( f - > { try { return ( int ) f get ( null ) ; } catch ( illegal access exception e ) { throw new assertion error ( e ) ; } } ) max ( ) or else ( 0 ) ; }


public x pack info response license info license info ( ) { return license info ; }


get this volume data density please see disk balancer volume set # compute volume data density to see how this is computed

public double get volume data density ( ) { return volume data density ; }


creates a unique and human - readable representation of the given certificate

public static string to string ( final x 5 0 9 certificate cert ) { return new to string builder ( cert , to string style no class name style ) append ( " subject dn " , cert get subject d n ( ) ) append ( " serial number " , cert get serial number ( ) ) build ( ) ; }


runs the consumer in a new context as the provided user the original context is provided to the consumer when this method returns , the original context is restored

public < t > t execute with authentication ( authentication authentication , function < stored context , t > consumer ) { final stored context original = thread context new stored context ( true ) ; try ( thread context stored context ignore = thread context stash context ( ) ) { set authentication ( authentication ) ; return consumer apply ( original ) ; } }


returns the record number of the underlying type of this enum

public record number get underlying record number ( ) { return underlying record number ; }


only select tasks for which users in the given group are candidates

t task candidate group ( string candidate group ) ;


returns the event formatted as { @ code " error foo bzl : 1 : 2 : oops " }

public string to string ( ) { location location = get location ( ) ; / / todo ( adonovan ) : < no location > is just noise return kind + " " + ( location ! = null ? location to string ( ) : " < no location > " ) + " : " + get message ( ) ; }


test the property ' map of map property '

public void map of map property test ( ) { / / todo : test map of map property }


expect a provider to raise an exception on failure

private i o exception expect provider instantiation failure ( string option , string expected error text ) throws exception { return intercept ( i o exception class , expected error text , ( ) - > create a w s credential provider set ( testfile uri , create provider configuration ( option ) ) ) ; }


generic utility function that wraps a single class object into an array of that class type

protected static < u > class < u > [ ] as array ( class < u > clazz ) { @ suppress warnings ( " unchecked " ) class < u > [ ] array = new class [ ] { clazz } ; return array ; }


returns the { @ link media format } signalled by the underlying { @ link media codec } call this < b > after < b > { @ link # dequeue output buffer index } returned { @ link media codec # info output format changed }

public media format get output format ( ) throws illegal state exception { if ( current format = = null ) { throw new illegal state exception ( ) ; } return current format ; }


tries to get the next cached entry if the pool is empty , this method returns null

public t try poll entry ( ) { return pool poll ( ) ; }


public event type get event type ( ) { return event type job priority changed ; }


add an action listener that will be notified anytime the user presses the return key while in the text field

public void add action listener ( action listener listener ) { this text field add action listener ( listener ) ; }


return the additional ( undeclared ) property with the specified name

public object get additional property ( string key ) { if ( this additional properties = = null ) { return null ; } return this additional properties get ( key ) ; }


returns an object that represents one of the choices in the given list the actual behavior of the method depends on your environment , which can be gui or headless regardless of environment - - if script arguments have been set , this method will use the next argument in the array and advance the array index so the next call to an ask method will get the next argument if there are no script arguments and a properties file sharing the same base name as the ghidra script exists ( i e , script 1 properties for script 1 java ) , then this method will then look there for the string value to return the method will look in the properties file by searching for a property name that is a space - separated concatenation of the input string parameters ( title + " " + message ) if that property name exists and its value represents a valid choice , then the properties value will be used in the following way : in the gui environment , this method displays a popup dialog that prompts the user to choose from the given list of objects the pre - chosen choice will be the last user - chosen value ( if the dialog has been run before ) if that does not exist , the pre - chosen value is the properties value if that does not exist or is invalid , then the ' default value ' parameter is used ( as long as it is not null ) in the headless environment , this method returns an object representing the properties value ( if it exists and is a valid choice ) , or throws an exception if there is an invalid or missing properties value

public < t > t ask choice ( string title , string message , list < t > choices , t default value ) throws cancelled exception { / / the value parser function is only a two parameter list ( string , t ) we have another / / parameter for this method ' s parse function so , curry it string transformer < t > curry = s - > parse choice ( s , choices ) ; string key = join ( title , message ) ; t existing value = load ask value ( default value , curry , key ) ; if ( is running headless ( ) ) { return existing value ; } class < ? > clazz = choices get ( 0 ) get class ( ) ; t choice = do ask ( clazz , title , message , existing value , last value - > { ask dialog < t > dialog = new ask dialog < > ( null , title , message , ask dialog string , choices , last value ) ; if ( dialog is canceled ( ) ) { throw new cancelled exception ( ) ; } t value = dialog get choice value ( ) ; return value ; } ) ; return choice ; }


returns a pretty - printed representation of this syntax tree this function returns the canonical source code corresponding to a syntax tree generally , the output can be round - tripped : pretty - printing a syntax tree then parsing the result should yield an equivalent syntax tree the pretty - printed form of a syntax tree may be used as a proxy for equality in tests however , different trees may have the same printed form in particular , { @ link starlark file } includes comments that are not reflected in the string

public final string pretty print ( ) { string builder buf = new string builder ( ) ; new node printer ( buf ) print node ( this ) ; return buf to string ( ) ; }


if somebody is unlucky enough to have to serialize one of these , serialize it as a linked hash map so that they won ' t need gson on the other side to deserialize it using serialization defeats our do s defence , so most apps shouldn ' t use it

private object write replace ( ) throws object stream exception { return new linked hash map < k , v > ( this ) ; }


swaps the values at { @ code i } and { @ code j } in { @ code array }

private static void swap ( double [ ] array , int i , int j ) { double temp = array [ i ] ; array [ i ] = array [ j ] ; array [ j ] = temp ; }


return the configured default user destination prefix

public string get default user destination prefix ( ) { return this default user destination prefix ; }


create a { @ code string [ ] } representing the argument signature of a method each element in the array is the fully qualified class name of the corresponding argument in the methods signature

public static string [ ] get method signature ( method method ) { class < ? > [ ] types = method get parameter types ( ) ; string [ ] signature = new string [ types length ] ; for ( int x = 0 ; x < types length ; x + + ) { signature [ x ] = types [ x ] get name ( ) ; } return signature ; }


< code > optional uint 3 2 type = 1 ; < code >

public int get type ( ) { return instance get type ( ) ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


appends the node to the tail of the list

public void append to tail ( node head ) { node tail = head prev ; head prev = this ; tail next = this ; next = head ; prev = tail ; }


invoked after the response is updated with the status code and headers , if the response body emitter is wrapped in a response entity , but before the response is committed , i e before the response body has been written to the default implementation is empty

protected void extend response ( server http response output message ) { }


executes a single http operation to complete the rest operation if it fails , there may be a retry the retry count is incremented with each attempt

private boolean execute http operation ( final int retry count ) throws azure blob file system exception { abfs http operation http operation = null ; try { / / initialize the http request and open the connection http operation = new abfs http operation ( url , method , request headers ) ; increment counter ( abfs statistic connections made , 1 ) ; switch ( client get auth type ( ) ) { case custom : case o auth : log debug ( " authenticating request with o auth 2 access token " ) ; http operation get connection ( ) set request property ( http header configurations authorization , client get access token ( ) ) ; break ; case sas : / / do nothing ; the sas token should already be appended to the query string break ; case shared key : / / sign the http request log debug ( " signing request with shared key " ) ; / / sign the http request client get shared key credentials ( ) sign request ( http operation get connection ( ) , has request body ? buffer length : 0 ) ; break ; } / / dump the headers abfs io utils dump headers to debug log ( " request headers " , http operation get connection ( ) get request properties ( ) ) ; abfs client throttling intercept sending request ( operation type , abfs counters ) ; if ( has request body ) { / / http url connection requires http operation send request ( buffer , buffer offset , buffer length ) ; increment counter ( abfs statistic send requests , 1 ) ; increment counter ( abfs statistic bytes sent , buffer length ) ; } http operation process response ( buffer , buffer offset , buffer length ) ; increment counter ( abfs statistic get responses , 1 ) ; / / only increment bytes received counter when the status code is 2xx if ( http operation get status code ( ) > = http u r l connection http ok & & http operation get status code ( ) < = http u r l connection http partial ) { increment counter ( abfs statistic bytes received , http operation get bytes received ( ) ) ; } } catch ( unknown host exception ex ) { string hostname = null ; if ( http operation ! = null ) { hostname = http operation get host ( ) ; } log warn ( " unknown host name : % s retrying to resolve the host name " , hostname ) ; if ( ! client get retry policy ( ) should retry ( retry count , - 1 ) ) { throw new invalid abfs rest operation exception ( ex ) ; } return false ; } catch ( i o exception ex ) { if ( log is debug enabled ( ) ) { if ( http operation ! = null ) { log debug ( " http request failure : " + http operation to string ( ) , ex ) ; } else { log debug ( " http request failure : " + method + " , " + url , ex ) ; } } if ( ! client get retry policy ( ) should retry ( retry count , - 1 ) ) { throw new invalid abfs rest operation exception ( ex ) ; } / / once http exception is thrown by azure a d authenticator , / / it indicates the policy in azure a d authenticator determined / / retry is not needed if ( ex instanceof http exception ) { throw new abfs rest operation exception ( ( http exception ) ex ) ; } return false ; } finally { abfs client throttling intercept update metrics ( operation type , http operation ) ; } log debug ( " http request : { } : { } " , operation type , http operation to string ( ) ) ; if ( client get retry policy ( ) should retry ( retry count , http operation get status code ( ) ) ) { return false ; } result = http operation ; return true ; }


validate properly formatted distinguished name example : ' cn = doe john , ou = x , ou = y , ou = do d , o = u s government , c = us '

private void validate d n ( string [ ] args , int i ) { if ( args length < ( i + 1 ) ) { display usage ( " invalid usage ! " ) ; system exit ( - 1 ) ; } string dn = args [ i ] ; try { x 5 0 0 principal x 5 0 0 user = new x 5 0 0 principal ( dn ) ; args [ i ] = " \ " " + x 5 0 0 user get name ( ) + " \ " " ; } catch ( exception e ) { msg error ( user admin class , " invalid dn : " + dn ) ; system exit ( - 1 ) ; } }


retains a list of the most recently played sounds and stops the sound played least recently if necessary for a new sound to play

protected void retain ( open a l sound sound , boolean stop ) { / / move the pointer ahead and wrap most recet sound + + ; most recet sound % = recent sounds length ; if ( stop ) { / / stop the least recent sound ( the one we are about to bump off the buffer ) if ( recent sounds [ most recet sound ] ! = null ) recent sounds [ most recet sound ] stop ( ) ; } recent sounds [ most recet sound ] = sound ; }


returns a new array of class object [ ] containing the list elements

public object [ ] to array ( ) { return size ! = 0 ? arrays copy of ( elems , size , object [ ] class ) : empty array ; }


calculate a sigmoid of < code > value < code > with scaling parameters < code > k < code > and < code > a < code >

public static double sigmoid ( double value , double k , double a ) { return math pow ( value , a ) / ( math pow ( k , a ) + math pow ( value , a ) ) ; }


public static string get accept encoding ( http servlet request req ) { string encode = string utils default if empty ( req get header ( " accept - charset " ) , standard charsets utf 8 name ( ) ) ; encode = encode contains ( " , " ) ? encode substring ( 0 , encode index of ( " , " ) ) : encode ; return encode contains ( " ; " ) ? encode substring ( 0 , encode index of ( " ; " ) ) : encode ; }


creates a g r p c server builder for the given port

public static alts server builder for port ( int port ) { netty server builder netty delegate = netty server builder for address ( new inet socket address ( port ) ) ; return new alts server builder ( netty delegate ) ; }


returns the comparator that orders the multimap keys

public comparator < ? super k > key comparator ( ) { return key comparator ; }


public float get percentile ( float percentile ) { ensure sorted by value ( ) ; float desired weight = percentile * total weight ; int accumulated weight = 0 ; for ( int i = 0 ; i < samples size ( ) ; i + + ) { sample current sample = samples get ( i ) ; accumulated weight + = current sample weight ; if ( accumulated weight > = desired weight ) { return current sample value ; } } / / clamp to maximum value or na n if no values return samples is empty ( ) ? float na n : samples get ( samples size ( ) - 1 ) value ; }


checks that the specified object reference is not { @ code null }

public static < t > t require non null ( t obj ) { if ( obj = = null ) throw new null pointer exception ( ) ; return obj ; }


public string get string item ( ) { return string item ; }


builder the { @ link database client } instance


converts the values of the map from { @ link test node } to { @ link test case node } filtering out null values

private static map < description , test case node > filter test cases ( map < description , test node > tests ) { map < description , test case node > filtered and converted tests = new hash map < > ( ) ; for ( description key : tests key set ( ) ) { test node test node = tests get ( key ) ; if ( test node instanceof test case node ) { filtered and converted tests put ( key , ( test case node ) test node ) ; } } return filtered and converted tests ; }


static void set node name ( string node name ) { node name set ( node name ) ; }


show the given tooltip on the component with the given handle instance

public static void show tooltip on handle ( component context c , final popup window popup window , handle handle , int x offset , int y offset ) { show tooltip on handle ( c , new litho tooltip ( ) { @ override public void show litho tooltip ( view container , rect anchor bounds , int x offset , int y offset ) { popup window show as drop down ( container , anchor bounds left + x offset , anchor bounds bottom + y offset ) ; } } , handle , x offset , y offset ) ; }


retrieves the value from the cache , loading it if necessary

private @ nullable v get or load ( k key ) { boolean stats enabled = statistics is enabled ( ) ; long start = stats enabled ? ticker read ( ) : 0l ; long millis = 0l ; expirable < v > expirable = cache get if present ( key ) ; if ( ( expirable ! = null ) & & ! expirable is eternal ( ) ) { millis = nanos to millis ( ( start = = 0l ) ? ticker read ( ) : start ) ; if ( expirable has expired ( millis ) ) { expirable < v > expired = expirable ; cache as map ( ) compute if present ( key , ( k , e ) - > { if ( e = = expired ) { dispatcher publish expired ( this , key , expired get ( ) ) ; statistics record evictions ( 1 ) ; return null ; } return e ; } ) ; expirable = null ; } } if ( expirable = = null ) { expirable = cache get ( key ) ; statistics record misses ( 1l ) ; } else { statistics record hits ( 1l ) ; } v value = null ; if ( expirable ! = null ) { set access expiration time ( key , expirable , millis ) ; value = copy value ( expirable ) ; } if ( stats enabled ) { statistics record get time ( ticker read ( ) - start ) ; } return value ; }


append message string to log buffer note : method has no affect unless constructed with verbose logging mode

public void append ( string str ) { if ( ! is verbose enabled ( ) ) { return ; } int index = str index of ( ' \ n ' ) ; while ( index > = 0 ) { check line start ( ) ; buffer append ( str substring ( 0 , index + 1 ) ) ; str = str substring ( index + 1 ) ; at line start = true ; index = str index of ( ' \ n ' ) ; } if ( str length ( ) ! = 0 ) { check line start ( ) ; buffer append ( str ) ; } }


public long get capacity ( ) throws i o exception { return volumes get capacity ( ) ; }


retrieves the default cache settings from the configuration resource

public static < k , v > caffeine configuration < k , v > defaults ( config config ) { return new configurator < k , v > ( config , " default " ) configure ( ) ; }


register all files recursively to be deleted on exit

public static void fully delete on exit ( final file file ) { file delete on exit ( ) ; if ( file is directory ( ) ) { file [ ] files = file list files ( ) ; if ( files ! = null ) { for ( file child : files ) { fully delete on exit ( child ) ; } } } }


public void set sender ( socket address sender ) { this sender = sender ; }


tests if we receive a confirmation when we attempt to open a file that it ' s name is null or an empty string

public void file confirmation when name is null ( ) { stub set file name ( null ) ; presenter start ( ) ; presenter file name changed ( ) ; presenter confirmed ( ) ; assert false ( loader is loaded ( ) ) ; assert equals ( 1 , stub get messages sent ( ) ) ; }


workaround to match normalized captions like english to english or deutsch to deutsch

public static boolean contains case insensitive ( final list < string > list , final string to find ) { for ( final string i : list ) { if ( i equals ignore case ( to find ) ) { return true ; } } return false ; }


public static profiled basic info parse form file ( file file ) throws i o exception { try ( file input stream file input stream = new file input stream ( file ) ) { return new yaml ( ) load as ( file input stream , profiled basic info class ) ; } }


boolean is lockable ( list < lock d o > lock d os ) ;


perform variable storage checks using the specified datatype

public static void check storage ( variable storage storage , data type data type , boolean allow size mismatch ) throws invalid input exception { check storage ( null , storage , data type , allow size mismatch ) ; }


public static float [ ] reallocate buffer ( float [ ] old buffer , int old capacity , int new capacity ) { assert ( new capacity > old capacity ) ; float [ ] new buffer = new float [ new capacity ] ; if ( old buffer ! = null ) { system arraycopy ( old buffer , 0 , new buffer , 0 , old capacity ) ; } return new buffer ; }


assert that the provided object is an instance of the provided class < pre class = " code " > assert instance of ( foo class , foo , ( ) - & gt ; " processing " + foo class get simple name ( ) + " : " ) ;

public static void is instance of ( class < ? > type , @ nullable object obj , supplier < string > message supplier ) { not null ( type , " type to check against must not be null " ) ; if ( ! type is instance ( obj ) ) { instance check failed ( type , obj , null safe get ( message supplier ) ) ; } }


accept a single line of the xml file , and return a { @ link block info } for any blocks contained within that line update internal state dependent on other xml values seen , e g the beginning of a file

list < block info > parse line ( string line ) throws i o exception { if ( current state = = state default ) { if ( line contains ( " < i node section > " ) ) { transition to ( state inode section ) ; } else { return collections empty list ( ) ; } } if ( line contains ( " < inode > " ) ) { transition to ( state inode ) ; } if ( line contains ( " < type > file < / type > " ) ) { transition to ( state file ) ; } list < string > replication strings = values from x m l string ( line , " replication " ) ; if ( ! replication strings is empty ( ) ) { if ( replication strings size ( ) > 1 ) { throw new i o exception ( string format ( " found % s replication strings " , replication strings size ( ) ) ) ; } transition to ( state file with replication ) ; current replication = short parse short ( replication strings get ( 0 ) ) ; } matcher block matcher = block pattern matcher ( line ) ; list < block info > block infos = new array list < > ( ) ; while ( block matcher find ( ) ) { if ( current state ! = state file with replication ) { throw new i o exception ( " found a block string when in state : " + current state ) ; } long id = long parse long ( block matcher group ( 1 ) ) ; long gs = long parse long ( block matcher group ( 2 ) ) ; long size = long parse long ( block matcher group ( 3 ) ) ; block infos add ( new block info ( id , gs , size , current replication ) ) ; } if ( line contains ( " < / inode > " ) ) { transition to ( state inode section ) ; } if ( line contains ( " < / i node section > " ) ) { transition to ( state default ) ; } return block infos ; }


this method retrieves the state for a specific app , and it is reachable by using { @ link r m w s consts # apps appid state }

app state get app state ( http servlet request hsr , string app id ) throws authorization exception ;


maps known control characters to corresponding escape sequences for example a line feed character would be converted to backslash ' \ \ ' character followed by an ' n ' character one use for this is to display strings in a manner to easily see the embedded control characters

public static string convert code point to escape sequence ( int code point ) { int char count = character char count ( code point ) ; string escaped ; if ( char count = = 1 & & ( escaped = control to escape string map get ( ( char ) code point ) ) ! = null ) { return escaped ; } return new string ( new int [ ] { code point } , 0 , 1 ) ; }


public int get value ( ) { return value ; }


returns a copy of the configured options which will be used for the child channels

public map < channel option < ? > , object > child options ( ) { return bootstrap child options ( ) ; }


get details instruction info as formatted text

public static string get formatted instruction details ( instruction instruction , sleigh debug logger debug ) { if ( instruction = = null ) { return null ; } string buffer text buf = new string buffer ( " instruction summary " ) ; text buf append ( " \ n - - - - - - - - - - - - - - - - - - - " ) ; text buf append ( " \ n mnemonic : " + instruction get mnemonic string ( ) ) ; text buf append ( " \ n number of operands : " + instruction get num operands ( ) ) ; text buf append ( " \ n address : " + instruction get min address ( ) to string ( true ) ) ; flow type flow type = instruction get flow type ( ) ; text buf append ( " \ n flow type : " + flow type to string ( ) ) ; flow override flow override = instruction get flow override ( ) ; if ( flow override ! = flow override none & & instruction get prototype ( ) get flow type ( instruction get instruction context ( ) ) ! = flow type ) { text buf append ( " \ n > > > reflects " + flow override + " flow override " ) ; } address fall addr = instruction get fall through ( ) ; text buf append ( " \ n fallthrough : " + ( fall addr ! = null ? fall addr : " < none > " ) ) ; if ( instruction is fall through overridden ( ) ) { text buf append ( " \ n > > > reflects fallthrough override " ) ; } text buf append ( " \ n delay slot depth : " + instruction get delay slot depth ( ) + ( instruction is in delay slot ( ) ? " in slot " : " " ) ) ; text buf append ( " \ n hash : " + integer to hex string ( instruction get prototype ( ) hash code ( ) ) ) append ( ' \ n ' ) ; text buf append ( " \ n input objects : \ n " + get string ( get formated instruction objects ( instruction , true ) , true ) ) ; text buf append ( " \ n result objects : \ n " + get string ( get formated instruction objects ( instruction , false ) , true ) ) ; text buf append ( " \ n constructor line # ' s : \ n " + get string ( debug get constructor line numbers ( ) , true ) ) append ( ' \ n ' ) ; text buf append ( " \ n byte length : " + instruction get length ( ) ) ; try { text buf append ( " \ n instr bytes : " + sleigh debug logger get formatted bytes ( instruction get bytes ( ) ) ) ; text buf append ( " \ n mask : " + debug get formatted instruction mask ( - 1 ) ) ; text buf append ( " \ n masked bytes : " + debug get formatted masked value ( - 1 ) ) append ( ' \ n ' ) ; } catch ( memory access exception e ) { / / ignore } text buf append ( " \ n instr context : \ n " ) ; text buf append ( get formatted context register value breakout ( instruction , " " ) ) ; return text buf to string ( ) ; }


returns { @ link error redis message } for given { @ code content } returns { @ code null } it does not exist

error redis message get error ( string content ) ;


optional , flush max size ( includes all append , upsert and delete records ) , over this number of records , will flush data

public builder set flush max size ( int flush max size ) { this flush max size = flush max size ; return this ; }


return { @ code true } if the reactive type does not produce any values and only provides completion and error signals

public boolean is no value ( ) { return this no value ; }


query configuration information ; database atomic operation , minimum sql action , no business encapsulation

config info find config info ( final string data id , final string group , final string tenant ) ;


private void remove ( ) { before after = after ; after before = before ; before = null ; / / null references to prevent nepotism in generational gc after = null ; next = null ; }


begins a speculative take operation this returns the item that would be returned by # take ( ) , but does not change state

public item take index ( int take rotation ) { for ( int i = 0 ; i < items length ; i + + ) { int index = ( i + take rotation ) ; if ( index > = items length ) index - = items length ; if ( items [ index ] > 0 ) { return content item ( index ) ; } } return null ; }


call a method by its name this is roughly equivalent to { @ link method # invoke ( object , object ) } if the wrapped object is a { @ link class } , then this will invoke a static method if the wrapped object is any other { @ link object } , then this will invoke an instance method just like { @ link method # invoke ( object , object ) } , this will try to wrap primitive types or unwrap primitive type wrappers if applicable if several methods are applicable , by that rule , the first one encountered is called i e when calling < code > on ( ) call ( " method " , 1 , 1 ) ; < code > the first of the following methods will be called : < code > public void method ( int param 1 , integer param 2 ) ; public void method ( integer param 1 , int param 2 ) ; public void method ( number param 1 , number param 2 ) ; public void method ( number param 1 , object param 2 ) ; public void method ( int param 1 , object param 2 ) ; < code > the best matching method is searched for with the following strategy : public method with exact signature match in class hierarchy non - public method with exact signature match on declaring class public method with similar signature in class hierarchy non - public method with similar signature on declaring class

public reflect call ( string name , object args ) throws reflect exception { class < ? > [ ] types = types ( args ) ; / / try invoking the " canonical " method , i e the one with exact / / matching argument types try { method method = exact method ( name , types ) ; return on ( method , object , args ) ; } / / if there is no exact match , try to find a method that has a " similar " / / signature if primitive argument types are converted to their wrappers catch ( no such method exception e ) { try { method method = similar method ( name , types ) ; return on ( method , object , args ) ; } catch ( no such method exception e 1 ) { throw new reflect exception ( e 1 ) ; } } }


get the unique start time for a given entity as a byte array that sorts the timestamps in reverse order ( see { @ link generic object mapper # write reverse ordered long ( long ) } ) if the start time doesn ' t exist , set it based on the information provided

private long get and set start time ( string entity id , string entity type , long start time , list < timeline event > events ) throws i o exception { entity identifier entity = new entity identifier ( entity id , entity type ) ; long time = start time write cache get ( entity ) ; if ( time ! = null ) { / / return the value in the cache return time ; } if ( start time = = null & & events ! = null ) { / / calculate best guess start time based on lowest event time start time = long max value ; for ( timeline event e : events ) { if ( e get timestamp ( ) < start time ) { start time = e get timestamp ( ) ; } } } / / check the provided start time matches the db return check start time in db ( entity , start time ) ; }


public void check output specs ( job context context ) throws i o exception { configuration conf = context get configuration ( ) ; if ( get commit directory ( conf ) = = null ) { throw new illegal state exception ( " commit directory not configured " ) ; } path working path = get working directory ( conf ) ; if ( working path = = null ) { throw new illegal state exception ( " working directory not configured " ) ; } / / get delegation token for out dir ' s file system token cache obtain tokens for namenodes ( context get credentials ( ) , new path [ ] { working path } , conf ) ; }


public void test retry cancellation ( ) throws exception { final int retries = 10 ; final atomic integer atomic integer = new atomic integer ( 0 ) ; final one shot latch notification latch = new one shot latch ( ) ; final one shot latch wait latch = new one shot latch ( ) ; final atomic reference < throwable > atomic throwable = new atomic reference < > ( null ) ; completable future < ? > retry future = future utils retry ( ( ) - > completable future supply async ( ( ) - > { if ( atomic integer increment and get ( ) = = 2 ) { notification latch trigger ( ) ; try { wait latch await ( ) ; } catch ( interrupted exception e ) { atomic throwable compare and set ( null , e ) ; } } throw new completion exception ( new flink exception ( " test exception " ) ) ; } , testing utils default executor ( ) ) , retries , testing utils default executor ( ) ) ; / / await that we have failed once notification latch await ( ) ; assert false ( retry future is done ( ) ) ; / / cancel the retry future retry future cancel ( false ) ; / / let the retry operation continue wait latch trigger ( ) ; assert true ( retry future is cancelled ( ) ) ; assert equals ( 2 , atomic integer get ( ) ) ; if ( atomic throwable get ( ) ! = null ) { throw new flink exception ( " exception occurred in the retry operation " , atomic throwable get ( ) ) ; } }


returns a substring of the given string , representing the ' length ' most - left characters

public static string left str ( string str , int length ) { return str substring ( 0 , math min ( str length ( ) , length ) ) ; }


whether to log form data at debug level , and headers at trace level both may contain sensitive information by default set to { @ code false } so that request details are not shown

void enable logging request details ( boolean enable ) ;


returns the set of registers which were modified

public list < register > get modified registers ( ) { if ( registers preserved = = null ) { reconcile modified registers ( ) ; } return registers modified ; }


sets the current field index of the field that corresponds to the start loc program location

private boolean get field for location ( listing field field , int field index ) { field factory ff = field get field factory ( ) ; field location floc = ff get field location ( field , big integer zero , field index , start location ) ; if ( floc = = null ) { return false ; } if ( ! do search field ( ff get field name ( ) ) ) { return false ; } / / now determine where to start searching within the string current field index = field index ; start index = field screen location to text offset ( floc get row ( ) , floc get col ( ) ) ; return true ; }


the test verifies output stream write of buffer size ( 4kb ) followed by a hflush call is making correct http calls to the server

public void verify write request of buffer size and h flush ( ) throws exception { abfs client client = mock ( abfs client class ) ; abfs rest operation op = mock ( abfs rest operation class ) ; when ( op get sas token ( ) ) then return ( " " ) ; abfs configuration abfs conf ; final configuration conf = new configuration ( ) ; conf set ( account key 1 , account value 1 ) ; abfs conf = new abfs configuration ( conf , account name 1 ) ; abfs perf tracker tracker = new abfs perf tracker ( " test " , account name 1 , abfs conf ) ; when ( client get abfs perf tracker ( ) ) then return ( tracker ) ; when ( client append ( any string ( ) , any ( byte [ ] class ) , any ( append request parameters class ) , any ( ) ) ) then return ( op ) ; when ( client flush ( any string ( ) , any long ( ) , any boolean ( ) , any boolean ( ) , any ( ) ) ) then return ( op ) ; abfs output stream out = new abfs output stream ( client , null , path , 0 , populate abfs output stream context ( buffer size , true , false , false ) ) ; final byte [ ] b = new byte [ buffer size ] ; new random ( ) next bytes ( b ) ; for ( int i = 0 ; i < 2 ; i + + ) { out write ( b ) ; } out hflush ( ) ; append request parameters first req parameters = new append request parameters ( 0 , 0 , buffer size , append mode , false ) ; append request parameters second req parameters = new append request parameters ( buffer size , 0 , buffer size , append mode , false ) ; verify ( client , times ( 1 ) ) append ( eq ( path ) , any ( byte [ ] class ) , ref eq ( first req parameters ) , any ( ) ) ; verify ( client , times ( 1 ) ) append ( eq ( path ) , any ( byte [ ] class ) , ref eq ( second req parameters ) , any ( ) ) ; / / confirm there were only 2 invocations in all verify ( client , times ( 2 ) ) append ( eq ( path ) , any ( byte [ ] class ) , any ( ) , any ( ) ) ; argument captor < string > ac flush path = argument captor for class ( string class ) ; argument captor < long > ac flush position = argument captor for class ( long class ) ; argument captor < boolean > ac flush retain un committed data = argument captor for class ( boolean class ) ; argument captor < boolean > ac flush close = argument captor for class ( boolean class ) ; argument captor < string > ac flush s a s token = argument captor for class ( string class ) ; verify ( client , times ( 1 ) ) flush ( ac flush path capture ( ) , ac flush position capture ( ) , ac flush retain un committed data capture ( ) , ac flush close capture ( ) , ac flush s a s token capture ( ) ) ; assert that ( arrays as list ( path ) ) described as ( " path " ) is equal to ( ac flush path get all values ( ) ) ; assert that ( arrays as list ( long value of ( 2 * buffer size ) ) ) described as ( " position " ) is equal to ( ac flush position get all values ( ) ) ; assert that ( arrays as list ( false ) ) described as ( " retain un committed data flag " ) is equal to ( ac flush retain un committed data get all values ( ) ) ; assert that ( arrays as list ( false ) ) described as ( " close flag " ) is equal to ( ac flush close get all values ( ) ) ; }


function for mapping from batch return type to response type often these two types are exactly the same so it ' s just a pass - thru

protected abstract func 1 < batch return type , response type > get batch return type to response type mapper ( ) ;


public abstract mapper build ( content path content path ) ;


returns the actual data bytes from the file for this section

public byte [ ] get data ( ) throws i o exception { if ( sh type = = elf section header constants sht nobits ) { return new byte [ 0 ] ; } if ( data ! = null ) { return data ; } if ( reader = = null ) { throw new unsupported operation exception ( " this elf section header does not have a reader " ) ; } return reader read byte array ( sh offset , ( int ) sh size ) ; }


takes an index and returns the matching address

public address get address at index ( int index ) { return mapping get address ( index ) ; }


public string get name string ( ) { return name string ; }


return true if the given key is in the hashtable

public boolean contains ( long key ) { return indexer get ( key ) > = 0 ; }


create a cull face attribute to be used in a material

public static int attribute create cull face ( int value ) { return new int attribute ( cull face , value ) ; }


convert a byte array in some { @ link x content } format to a { @ link map } throws an { @ link elasticsearch parse exception } if there is any error note that unlike { @ link # convert to map ( bytes reference , boolean ) } , this doesn ' t automatically uncompress the input

public static map < string , object > convert to map ( x content x content , byte [ ] bytes , int offset , int length , boolean ordered ) throws elasticsearch parse exception { / / it is safe to use empty here because this never uses named object try ( x content parser parser = x content create parser ( named x content registry empty , deprecation handler throw unsupported operation , bytes , offset , length ) ) { return ordered ? parser map ordered ( ) : parser map ( ) ; } catch ( i o exception e ) { throw new elasticsearch parse exception ( " failed to parse content to map " , e ) ; } }