idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
142,900
public static void printUsage ( PrintWriter out ) { CliArguments arguments = new CliArguments ( ) ; CmdLineParser parser = new CmdLineParser ( arguments ) ; parser . setUsageWidth ( 120 ) ; parser . printUsage ( out , null ) ; }
Prints the usage information for the CLI
142,901
public boolean isSet ( ) { if ( isUsageMode ( ) ) { return true ; } if ( getJobFile ( ) != null ) { return true ; } if ( getListType ( ) != null ) { return true ; } return false ; }
Gets whether the arguments have been sufficiently set to execute a CLI task .
142,902
private void writeObject ( ObjectOutputStream out ) throws IOException { logger . info ( "Serialization requested, awaiting reference to load." ) ; get ( ) ; out . defaultWriteObject ( ) ; logger . info ( "Serialization finished!" ) ; }
Method invoked when serialization takes place . Makes sure that we await the loading of the result reference before writing any data .
142,903
public static EscEvents create ( final JsonArray jsonArray ) { final List < EscEvent > events = new ArrayList < > ( ) ; for ( final JsonValue jsonValue : jsonArray ) { if ( jsonValue . getValueType ( ) != JsonValue . ValueType . OBJECT ) { throw new IllegalArgumentException ( "All elements in the JSON array must be an ...
Creates in instance from the given JSON array .
142,904
static KAFDocument load ( File file ) throws IOException , JDOMException , KAFNotValidException { SAXBuilder builder = new SAXBuilder ( ) ; Document document = ( Document ) builder . build ( file ) ; Element rootElem = document . getRootElement ( ) ; return DOMToKAF ( document ) ; }
Loads the content of a KAF file into the given KAFDocument object
142,905
static KAFDocument load ( Reader stream ) throws IOException , JDOMException , KAFNotValidException { SAXBuilder builder = new SAXBuilder ( ) ; Document document = ( Document ) builder . build ( stream ) ; Element rootElem = document . getRootElement ( ) ; return DOMToKAF ( document ) ; }
Loads the content of a String in KAF format into the given KAFDocument object
142,906
static void save ( KAFDocument kaf , String filename ) { try { File file = new File ( filename ) ; Writer out = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file ) , "UTF8" ) ) ; out . write ( kafToStr ( kaf ) ) ; out . flush ( ) ; } catch ( Exception e ) { System . out . println ( "Error writin...
Writes the content of a given KAFDocument to a file .
142,907
static void print ( KAFDocument kaf ) { try { Writer out = new BufferedWriter ( new OutputStreamWriter ( System . out , "UTF8" ) ) ; out . write ( kafToStr ( kaf ) ) ; out . flush ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } }
Writes the content of a KAFDocument object to standard output .
142,908
static String kafToStr ( KAFDocument kaf ) { XMLOutputter out = new XMLOutputter ( Format . getPrettyFormat ( ) . setLineSeparator ( LineSeparator . UNIX ) . setTextMode ( Format . TextMode . TRIM_FULL_WHITE ) ) ; Document jdom = KAFToDOM ( kaf ) ; return out . outputString ( jdom ) ; }
Returns a string containing the XML content of a KAFDocument object .
142,909
public Query getOptimizedQuery ( ) { Query q = _baseQuery . clone ( ) ; Set < Entry < FilterConsumer , FilterOutcome > > entries = _optimizedFilters . entrySet ( ) ; for ( Entry < FilterConsumer , FilterOutcome > entry : entries ) { FilterConsumer consumer = entry . getKey ( ) ; FilterOutcome outcome = entry . getValue...
Gets the optimized query .
142,910
public List < Token > tokenize ( String s ) { List < Token > result = new ArrayList < Token > ( ) ; result . add ( new UndefinedToken ( s ) ) ; for ( PredefinedTokenDefinition predefinedTokenDefinition : _predefinedTokenDefitions ) { Set < Pattern > patterns = predefinedTokenDefinition . getTokenRegexPatterns ( ) ; for...
Will only return either tokens with type PREDEFINED or UNDEFINED
142,911
public void doLog ( String clientID , String name , long time , Level level , Object message , Throwable t ) { if ( logOpen && formatter != null ) { sendMessage ( syslogMessage . createMessageData ( formatter . format ( clientID , name , time , level , message , t ) ) ) ; } }
Do the logging .
142,912
public String format ( String clientID , String name , long time , Level level , Object message , Throwable t ) { if ( ! patternParsed && pattern != null ) { parsePattern ( pattern ) ; } StringBuffer formattedStringBuffer = new StringBuffer ( 64 ) ; if ( commandArray != null ) { int length = commandArray . length ; for...
Format the input parameters .
142,913
public void setPattern ( String pattern ) throws IllegalArgumentException { if ( pattern == null ) { throw new IllegalArgumentException ( "The pattern must not be null." ) ; } this . pattern = pattern ; parsePattern ( this . pattern ) ; }
Set the pattern that is when formatting .
142,914
private void parsePattern ( String pattern ) { int currentIndex = 0 ; int patternLength = pattern . length ( ) ; Vector < FormatCommandInterface > converterVector = new Vector < FormatCommandInterface > ( 20 ) ; while ( currentIndex < patternLength ) { char currentChar = pattern . charAt ( currentIndex ) ; if ( current...
Parse the pattern .
142,915
public static < K , V > Map < K , V > zip ( List < K > keys , List < V > values ) { checkArgument ( keys != null , "Expected non-null keys" ) ; checkArgument ( values != null , "Expected non-null values" ) ; checkArgument ( keys . size ( ) == values . size ( ) , "Expected equal size of lists, got %s and %s" , keys . si...
Combine two lists into a map . Lists must have the same size .
142,916
public static < K , V > Map . Entry < K , V > getOnlyEntry ( Map < K , V > map ) { checkArgument ( map != null , "Expected non-null map" ) ; return getOnlyElement ( map . entrySet ( ) ) ; }
Gets the only element from a given map or throws an exception
142,917
public static < K , V > Map < K , V > mergeMaps ( Map < K , V > first , Map < K , V > second , V defaultValue ) { checkArgument ( first != null , "Expected non-null first map" ) ; checkArgument ( second != null , "Expected non-null second map" ) ; checkArgument ( defaultValue != null , "Expected non-null default value"...
Mergers two maps handling null keys null values and duplicates
142,918
public static < M extends PMessage < M , F > , F extends PField , B extends PMessageBuilder < M , F > > List < M > buildAll ( Collection < B > builders ) { if ( builders == null ) { return null ; } return builders . stream ( ) . map ( PMessageBuilder :: build ) . collect ( Collectors . toList ( ) ) ; }
Build all items of the collection containing builders . The list must not contain any null items .
142,919
@ SuppressWarnings ( "unchecked" ) public static < M extends PMessage < M , F > , F extends PField , B extends PMessageBuilder < M , F > > List < B > mutateAll ( Collection < M > messages ) { if ( messages == null ) { return null ; } return ( List < B > ) messages . stream ( ) . map ( PMessage :: mutate ) . collect ( C...
Mutate all items of the collection containing messages . The list must not contain any null items .
142,920
public static < M extends PMessage < M , F > , F extends PField , B extends PMessageBuilder < M , F > > M buildIfNotNull ( B builder ) { if ( builder == null ) { return null ; } return builder . build ( ) ; }
Build the message from builder if it is not null .
142,921
@ SuppressWarnings ( "unchecked" ) public static < M extends PMessage < M , F > , F extends PField , B extends PMessageBuilder < M , F > > B mutateIfNotNull ( M message ) { if ( message == null ) { return null ; } return ( B ) message . mutate ( ) ; }
Mutate the message if it is not null .
142,922
static boolean isSupported ( int index ) { if ( ( index <= 0 ) || ( index >= NAMED_CURVE_OID_TABLE . length ) ) { return false ; } if ( fips == false ) { return true ; } return DEFAULT . contains ( index ) ; }
Test whether we support the curve with the given index .
142,923
public static < M extends PMessage < M , F > , F extends PField > MessageFieldArgument < M , F > toField ( M message , F field ) { return new MessageFieldArgument < > ( message , field ) ; }
Bind to the given field for the message .
142,924
public static < F extends PField > MappedField < F > withColumn ( F field ) { return new MappedField < > ( field . getName ( ) , field ) ; }
With column mapped to field using the field name .
142,925
public static < F extends PField > MappedField < F > withColumn ( String name , F field ) { return new MappedField < > ( name , field ) ; }
With column mapped to field .
142,926
public AuthenticationInfo beforeAllAttempts ( Collection < ? extends Realm > realms , AuthenticationToken token ) throws AuthenticationException { final SimpleAuthenticationInfo authenticationInfo = ( SimpleAuthenticationInfo ) super . beforeAllAttempts ( realms , token ) ; authenticationInfo . setPrincipals ( new Prin...
Reconfigures the SimpleAuthenticationInfo to use a implementation for storing its PrincipalCollections .
142,927
protected final void set ( M config ) { ArrayList < WeakReference < ConfigListener < M , F > > > iterateOver ; synchronized ( this ) { M old = instance . get ( ) ; if ( old == config || ( old != null && old . equals ( config ) ) ) { return ; } instance . set ( config ) ; lastUpdateTimestamp . set ( clock . millis ( ) )...
Set a new config value to the supplier . This is protected as it is usually up to the supplier implementation to enable updating the config at later stages .
142,928
private List < AgigaTypedDependency > parseDependencies ( VTDNav vn , DependencyForm form ) throws NavException , PilotException { require ( vn . matchElement ( AgigaConstants . SENTENCE ) ) ; require ( vn . toElement ( VTDNav . FC , form . getXmlTag ( ) ) ) ; List < AgigaTypedDependency > agigaDeps = new ArrayList < A...
Assumes the position of vn is at a sent tag
142,929
public void configure ( String filename , boolean isExternalFile ) { try { Properties properties ; InputStream inputStream ; if ( ! isExternalFile ) { Resources resources = context . getResources ( ) ; AssetManager assetManager = resources . getAssets ( ) ; inputStream = assetManager . open ( filename ) ; } else { inpu...
Configure using the specified filename .
142,930
public void configure ( int resId ) { Resources resources = context . getResources ( ) ; try { InputStream rawResource = resources . openRawResource ( resId ) ; Properties properties = loadProperties ( rawResource ) ; startConfiguration ( properties ) ; } catch ( NotFoundException e ) { Log . e ( TAG , "Did not find r...
Configure using the specified resource Id .
142,931
private void startConfiguration ( Properties properties ) { if ( properties . containsKey ( Configurator . ROOT_LOGGER_KEY ) ) { Log . i ( TAG , "Modern configuration not yet supported" ) ; } else { Log . i ( TAG , "Configure using the simple style (aka classic style)" ) ; configureSimpleStyle ( properties ) ; } }
Start the configuration
142,932
void setVersion ( ProtocolVersion protocolVersion ) { this . protocolVersion = protocolVersion ; setVersionSE ( protocolVersion ) ; output . r . setVersion ( protocolVersion ) ; }
Set the active protocol version and propagate it to the SSLSocket and our handshake streams . Called from ClientHandshaker and ServerHandshaker with the negotiated protocol version .
142,933
void activate ( ProtocolVersion helloVersion ) throws IOException { if ( activeProtocols == null ) { activeProtocols = getActiveProtocols ( ) ; } if ( activeProtocols . collection ( ) . isEmpty ( ) || activeProtocols . max . v == ProtocolVersion . NONE . v ) { throw new SSLHandshakeException ( "No appropriate protocol ...
Prior to handshaking activate the handshake and initialize the version input stream and output stream .
142,934
boolean isNegotiable ( CipherSuite s ) { if ( activeCipherSuites == null ) { activeCipherSuites = getActiveCipherSuites ( ) ; } return activeCipherSuites . contains ( s ) && s . isNegotiable ( ) ; }
Check if the given ciphersuite is enabled and available . Does not check if the required server certificates are available .
142,935
boolean isNegotiable ( ProtocolVersion protocolVersion ) { if ( activeProtocols == null ) { activeProtocols = getActiveProtocols ( ) ; } return activeProtocols . contains ( protocolVersion ) ; }
Check if the given protocol version is enabled and available .
142,936
ProtocolVersion selectProtocolVersion ( ProtocolVersion protocolVersion ) { if ( activeProtocols == null ) { activeProtocols = getActiveProtocols ( ) ; } return activeProtocols . selectProtocolVersion ( protocolVersion ) ; }
Select a protocol version from the list . Called from ServerHandshaker to negotiate protocol version .
142,937
CipherSuiteList getActiveCipherSuites ( ) { if ( activeCipherSuites == null ) { if ( activeProtocols == null ) { activeProtocols = getActiveProtocols ( ) ; } ArrayList < CipherSuite > suites = new ArrayList < > ( ) ; if ( ! ( activeProtocols . collection ( ) . isEmpty ( ) ) && activeProtocols . min . v != ProtocolVersi...
Get the active cipher suites .
142,938
CipherBox newReadCipher ( ) throws NoSuchAlgorithmException { BulkCipher cipher = cipherSuite . cipher ; CipherBox box ; if ( isClient ) { box = cipher . newCipher ( protocolVersion , svrWriteKey , svrWriteIV , sslContext . getSecureRandom ( ) , false ) ; svrWriteKey = null ; svrWriteIV = null ; } else { box = cipher ....
Create a new read cipher and return it to caller .
142,939
MAC newReadMAC ( ) throws NoSuchAlgorithmException , InvalidKeyException { MacAlg macAlg = cipherSuite . macAlg ; MAC mac ; if ( isClient ) { mac = macAlg . newMac ( protocolVersion , svrMacSecret ) ; svrMacSecret = null ; } else { mac = macAlg . newMac ( protocolVersion , clntMacSecret ) ; clntMacSecret = null ; } ret...
Create a new read MAC and return it to caller .
142,940
static void throwSSLException ( String msg , Throwable cause ) throws SSLException { SSLException e = new SSLException ( msg ) ; e . initCause ( cause ) ; throw e ; }
Throw an SSLException with the specified message and cause . Shorthand until a new SSLException constructor is added . This method never returns .
142,941
static Object getInMessage ( PMessage message , String key ) throws ProvidenceConfigException { return getInMessage ( message , key , null ) ; }
Look up a key in the message structure . If the key is not found return null .
142,942
static Object getInMessage ( PMessage message , final String key , Object defValue ) throws ProvidenceConfigException { String sub = key ; String name ; PMessageDescriptor descriptor = message . descriptor ( ) ; while ( sub . contains ( "." ) ) { int idx = sub . indexOf ( "." ) ; name = sub . substring ( 0 , idx ) ; su...
Look up a key in the message structure . If the key is not found return the default value . Note that the default value will be converted to the type of the declared field not returned verbatim .
142,943
static double asDouble ( Object value ) throws ProvidenceConfigException { if ( value instanceof Number ) { return ( ( Number ) value ) . doubleValue ( ) ; } else if ( value instanceof Numeric ) { return ( ( Numeric ) value ) . asInteger ( ) ; } throw new ProvidenceConfigException ( "Unable to convert " + value . getCl...
Convert the value to a double .
142,944
static String asString ( Object value ) throws ProvidenceConfigException { if ( value instanceof Collection || value instanceof Map ) { throw new ProvidenceConfigException ( "Unable to convert " + value . getClass ( ) . getSimpleName ( ) + " to a string" ) ; } else if ( value instanceof Stringable ) { return ( ( String...
Convert the value to a string .
142,945
static Path resolveFile ( Path reference , String path ) throws IOException { if ( reference == null ) { Path file = canonicalFileLocation ( Paths . get ( path ) ) ; if ( Files . exists ( file ) ) { if ( Files . isRegularFile ( file ) ) { return file ; } throw new FileNotFoundException ( path + " is a directory, expect...
Resolve a file path within the source roots .
142,946
public static int getNextAvailablePort ( int fromPort , int toPort ) { if ( fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort ) { throw new IllegalArgumentException ( format ( "Invalid port range: %d ~ %d" , fromPort , toPort ) ) ; } int nextPort = fromPort ; while ( ! isPortAvailable ( nextPo...
Returns a currently available port number in the specified range .
142,947
public static boolean isPortAvailable ( int port ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "Testing port " ) . append ( port ) . append ( "\n" ) ; try ( Socket s = new Socket ( "localhost" , port ) ) { builder . append ( "Port " ) . append ( port ) . append ( " is not available" ) . append ...
Checks if a port is available by opening a socket on it
142,948
public Collection < F > presentFields ( ) { return Arrays . stream ( descriptor ( ) . getFields ( ) ) . filter ( this :: isSet ) . collect ( Collectors . toList ( ) ) ; }
Get a Collection of F with fields set on the builder . A . k . a is present .
142,949
public Collection < F > modifiedFields ( ) { return Arrays . stream ( descriptor ( ) . getFields ( ) ) . filter ( this :: isModified ) . collect ( Collectors . toList ( ) ) ; }
Get a Collection of F with fields Modified since creation of the builder .
142,950
public static < T extends Enum < T > & RichEnum < T > > RichEnumConstants < T > richConstants ( Class < T > theClass ) { return new RichEnumConstants < > ( theClass ) ; }
The factory method
142,951
public void putConfigurationValue ( String key , Object value ) { this . configuration . put ( key , value ) ; }
Put a value in the module configuration map .
142,952
public java . util . Optional < String > optionalFilePath ( ) { return java . util . Optional . ofNullable ( mFilePath ) ; }
Full absolute path to the file .
142,953
public java . util . Optional < java . util . List < String > > optionalFileLines ( ) { return java . util . Optional . ofNullable ( mFileLines ) ; }
The lines of the program file
142,954
public java . util . Optional < net . morimekta . providence . model . ProgramType > optionalProgram ( ) { return java . util . Optional . ofNullable ( mProgram ) ; }
The program type definition
142,955
public ProgramTypeRegistry registryForPath ( String path ) { return registryMap . computeIfAbsent ( path , p -> new ProgramTypeRegistry ( programNameFromPath ( path ) ) ) ; }
Get a program type registry for the file at given path . If the registry is not created yet it will be created .
142,956
public boolean containsProgramPath ( String path ) { return registryMap . containsKey ( path ) && registryMap . get ( path ) . getProgram ( ) != null ; }
Gets the document for a given file path .
142,957
public void completeFrame ( ) throws IOException { int frameSize = buffer . position ( ) ; if ( frameSize > 0 ) { frameSizeBuffer . rewind ( ) ; try ( ByteBufferOutputStream bos = new ByteBufferOutputStream ( frameSizeBuffer ) ; BinaryWriter writer = new BigEndianBinaryWriter ( bos ) ) { writer . writeInt ( frameSize )...
Write the frame at the current state and reset the buffer to be able to generate a new frame .
142,958
public synchronized void put ( ApnsConnection connection ) { if ( connection == null ) { throw new IllegalArgumentException ( "connection must not be null" ) ; } if ( mPool . size ( ) < mCapacity ) { mPool . add ( connection ) ; } }
If and only if size of the pool is less than its capacity then connection is put into the pool and size of the pool incremented by one ; otherwise method argument is ignored and pool is not changed .
142,959
public static HashCode newHash ( String input , HashFunction function ) { return function . hashString ( input , Charsets . UTF_8 ) ; }
Creates a UTF - 8 encoded hash using the hash function
142,960
private static boolean equalsQualifiedName ( PDescriptor a , PDescriptor b ) { return ( a != null ) && ( b != null ) && ( a . getQualifiedName ( ) . equals ( b . getQualifiedName ( ) ) ) ; }
Check if the two descriptors has the same qualified name i .. e symbolically represent the same type .
142,961
private boolean setupPrivateKeyAndChain ( String algorithm ) { X509ExtendedKeyManager km = sslContext . getX509KeyManager ( ) ; String alias ; if ( conn != null ) { alias = km . chooseServerAlias ( algorithm , null , conn ) ; } else { alias = km . chooseEngineServerAlias ( algorithm , null , engine ) ; } if ( alias == ...
Retrieve the server key and certificate for the specified algorithm from the KeyManager and set the instance variables .
142,962
private boolean setupKerberosKeys ( ) { if ( kerberosKeys != null ) { return true ; } try { final AccessControlContext acc = getAccSE ( ) ; kerberosKeys = AccessController . doPrivileged ( new PrivilegedExceptionAction < SecretKey [ ] > ( ) { public SecretKey [ ] run ( ) throws Exception { return Krb5Helper . getServer...
Retrieve the Kerberos key for the specified server principal from the JAAS configuration file .
142,963
public boolean implies ( final ApplicationFeatureId featureId , final ApplicationPermissionMode mode ) { if ( getRule ( ) != ApplicationPermissionRule . ALLOW ) { return false ; } if ( getMode ( ) == ApplicationPermissionMode . VIEWING && mode == ApplicationPermissionMode . CHANGING ) { return false ; } return onPathOf...
region > implies refutes
142,964
public static PPrimitive findByName ( String name ) { switch ( name ) { case "void" : return VOID ; case "bool" : return BOOL ; case "byte" : case "i8" : return BYTE ; case "i16" : return I16 ; case "i32" : return I32 ; case "i64" : return I64 ; case "double" : return DOUBLE ; case "string" : return STRING ; case "bina...
Find primitive by name .
142,965
public String execute ( String clientID , String name , long time , Level level , Object message , Throwable throwable ) { StringBuilder sb = new StringBuilder ( ) ; if ( throwable != null ) { sb . append ( throwable . toString ( ) ) ; String newline = System . getProperty ( "line.separator" ) ; StackTraceElement [ ] s...
Set the log data .
142,966
public String createMessageData ( String message ) { messageStringBuffer . delete ( 0 , messageStringBuffer . length ( ) ) ; messageStringBuffer . append ( '<' ) ; int priority = facility * 8 + severity ; messageStringBuffer . append ( priority ) ; messageStringBuffer . append ( '>' ) ; if ( header ) { long currentTime...
Create the syslog message data that is consequently wrapped in a datagram .
142,967
public void setFacility ( byte facility ) { if ( facility < SyslogMessage . FACILITY_KERNAL_MESSAGE || facility > SyslogMessage . FACILITY_LOCAL_USE_7 ) { throw new IllegalArgumentException ( "Not a valid facility." ) ; } this . facility = facility ; }
Set the facility that is used when sending message .
142,968
public void setSeverity ( byte severity ) throws IllegalArgumentException { if ( severity < SyslogMessage . SEVERITY_EMERGENCY || severity > SyslogMessage . SEVERITY_DEBUG ) { throw new IllegalArgumentException ( "Not a valid severity." ) ; } this . severity = severity ; }
Get the severity at which the message shall be sent .
142,969
public void setTag ( String tag ) throws IllegalArgumentException { if ( tag == null || ( tag != null && ( tag . length ( ) < 1 || tag . length ( ) > 32 ) ) ) { throw new IllegalArgumentException ( "The tag must not be null, the length between 1..32" ) ; } this . tag = tag ; }
Set the tag that is used for the TAG field in the MSG part of the message . The TAG length must not exceed 32 chars .
142,970
public static Properties getFileAsProperties ( String path ) { File file = new File ( nullToEmpty ( path ) ) ; return getFileAsProperties ( file ) ; }
Loads properties from file path
142,971
public java . util . Optional < net . morimekta . util . Binary > optionalData ( ) { return java . util . Optional . ofNullable ( mData ) ; }
The actual content binary data .
142,972
private void reload ( ) { try { if ( ! configFile . exists ( ) ) { LOGGER . warn ( "Config file deleted " + configFile + ", keeping old config." ) ; return ; } LOGGER . trace ( "Config reload triggered for " + configFile ) ; if ( parentSupplier != null ) { set ( loadConfig ( parentSupplier . get ( ) ) ) ; } else { set ...
Trigger reloading of the config file .
142,973
public static < Message extends PMessage < Message , Field > , Field extends PField > Message readMessage ( BigEndianBinaryReader input , PMessageDescriptor < Message , Field > descriptor , boolean strict ) throws IOException { PMessageBuilder < Message , Field > builder = descriptor . builder ( ) ; if ( builder instan...
Read message from reader .
142,974
public static void consumeMessage ( BigEndianBinaryReader in ) throws IOException { FieldInfo fieldInfo ; while ( ( fieldInfo = readFieldInfo ( in ) ) != null ) { readFieldValue ( in , fieldInfo , null , false ) ; } }
Consume a message from the stream without parsing the content into a message .
142,975
public static < Message extends PMessage < Message , Field > , Field extends PField > int writeMessage ( BigEndianBinaryWriter writer , Message message ) throws IOException { if ( message instanceof BinaryWriter ) { return ( ( BinaryWriter ) message ) . writeBinary ( writer ) ; } int len = 0 ; if ( message instanceof P...
Write message to writer .
142,976
protected void register ( Serializer serializer , String ... mediaTypes ) { for ( String mediaType : mediaTypes ) { this . serializerMap . put ( mediaType , serializer ) ; } }
Register the serializer with a given set of media types .
142,977
public String getContentLocation ( ) { String [ ] values = getMimeHeader ( "Content-Location" ) ; if ( values != null && values . length > 0 ) return values [ 0 ] ; return null ; }
Retrieves the value of the MIME header whose name is Content - Location .
142,978
public String readBinary ( char end ) throws IOException { int startOffset = bufferOffset ; int startLinePos = linePos ; CharArrayWriter baos = new CharArrayWriter ( ) ; while ( readNextChar ( ) ) { if ( lastChar == end ) { lastChar = 0 ; return baos . toString ( ) ; } else if ( lastChar == ' ' || lastChar == '\t' || l...
Read the content of encoded binary . This does not parse the binary just read out from the buffer the string representing the binary data as delimited by the requested end char .
142,979
public static ApplicationFeatureViewModel newViewModel ( final ApplicationFeatureId featureId , final ApplicationFeatureRepositoryDefault applicationFeatureRepository , final DomainObjectContainer container ) { final Class < ? extends ApplicationFeatureViewModel > cls = viewModelClassFor ( featureId , applicationFeatur...
region > constructors
142,980
@ Property ( domainEvent = MemberNameDomainEvent . class ) @ PropertyLayout ( typicalLength = ApplicationFeature . TYPICAL_LENGTH_MEMBER_NAME ) @ MemberOrder ( name = "Id" , sequence = "2.4" ) public String getMemberName ( ) { return getFeatureId ( ) . getMemberName ( ) ; }
For packages and class names will be null .
142,981
public ApplicationFeatureViewModel getParentPackage ( ) { return Functions . asViewModelForId ( applicationFeatureRepository , container ) . apply ( getFeatureId ( ) . getParentPackageId ( ) ) ; }
The parent package feature of this class or package .
142,982
public ApplicationUser findByUsernameCached ( final String username ) { return queryResultsCache . execute ( new Callable < ApplicationUser > ( ) { public ApplicationUser call ( ) throws Exception { return findByUsername ( username ) ; } } , ApplicationUserRepository . class , "findByUsernameCached" , username ) ; }
region > findByUsername
142,983
public List < ApplicationUser > findByAtPath ( final String atPath ) { return container . allMatches ( new QueryDefault < > ( ApplicationUser . class , "findByAtPath" , "atPath" , atPath ) ) ; }
region > allUsers
142,984
@ SuppressWarnings ( "unchecked" ) private static < V > V resolve ( ProvidenceConfigContext context , Token token , Tokenizer tokenizer , PDescriptor descriptor ) throws TokenizerException { Object value = resolveAny ( context , token , tokenizer ) ; if ( value == null ) { return null ; } return ( V ) asType ( descript...
Resolve a value reference .
142,985
public static ClassLoader getContextClassLoader ( Class < ? > contextClass ) { return Objects . firstNonNull ( Thread . currentThread ( ) . getContextClassLoader ( ) , contextClass . getClassLoader ( ) ) ; }
Returns current thread context class loader or context class s class loader
142,986
public static String buildPath ( String first , String ... parts ) { StringBuilder result = new StringBuilder ( first ) ; for ( String part : parts ) { if ( result . length ( ) == 0 ) { if ( part . startsWith ( "/" ) ) { result . append ( part . substring ( 1 ) ) ; } else { result . append ( part ) ; } } else { if ( re...
Concatenate path parts into a full path taking care of extra or missing slashes .
142,987
private TokenType lexUtf8Char ( Bytes jsonText , int curChar ) { if ( curChar <= 0x7f ) { return STRING ; } else if ( ( curChar >> 5 ) == 0x6 ) { if ( jsonText . readRemaining ( ) == 0 ) return EOF ; curChar = readChar ( jsonText ) ; if ( ( curChar >> 6 ) == 0x2 ) return STRING ; } else if ( ( curChar >> 4 ) == 0x0e ) ...
process a variable length utf8 encoded codepoint .
142,988
private TokenType lexString ( Bytes jsonText ) { TokenType tok = ERROR ; boolean hasEscapes = false ; finish_string_lex : for ( ; ; ) { int curChar ; { if ( bufInUse && buf . readRemaining ( ) > 0 ) { stringScan ( buf ) ; } else if ( jsonText . readRemaining ( ) > 0 ) { stringScan ( jsonText ) ; } } if ( jsonText . rea...
Lex a string .
142,989
public static < T > Predicate < T > nor ( Predicate < ? super T > first , Predicate < ? super T > second ) { return com . google . common . base . Predicates . not ( com . google . common . base . Predicates . or ( first , second ) ) ; }
NOT OR Predicate
142,990
public JsonParserBuilder options ( JsonParserOption first , JsonParserOption ... rest ) { this . options = EnumSet . of ( first , rest ) ; return this ; }
Sets the parser options . The previous options if any are discarded .
142,991
public JsonParserBuilder applyAdapter ( JsonHandlerBase a ) { boolean applied = false ; if ( a instanceof ObjectStartHandler ) { objectStartHandler ( ( ObjectStartHandler ) a ) ; applied = true ; } if ( a instanceof ObjectEndHandler ) { objectEndHandler ( ( ObjectEndHandler ) a ) ; applied = true ; } if ( a instanceof ...
Convenient method to apply the adapter which implements several handler interfaces in one call .
142,992
public static String camelCase ( String prefix , String name ) { return Strings . camelCase ( prefix , name ) ; }
Format a prefixed name as camelCase . The prefix is kept verbatim while tha name is split on _ chars and joined with each part capitalized .
142,993
public static String macroCase ( String name ) { return Strings . c_case ( name ) . toUpperCase ( Locale . US ) ; }
Format a prefixed name as MACRO_CASE .
142,994
public static void ensure ( boolean condition , String message , Object ... args ) { if ( ! condition ) { throw new EnsureViolation ( format ( message , args ) ) ; } }
Postcondition that supplier are supposed to ensure . Violations are considered to be a programming error on the suppliers part .
142,995
public void reset ( ) { lexer . reset ( ) ; stateStack . clear ( ) ; stateStack . push ( START ) ; parseError = null ; if ( resetHook != null ) resetHook . onReset ( ) ; }
Resets the parser to clear just like after construction state .
142,996
public boolean finish ( ) { if ( ! parse ( finishSpace ( ) ) ) return false ; switch ( stateStack . current ( ) ) { case PARSE_ERROR : case LEXICAL_ERROR : case HANDLER_CANCEL : case HANDLER_EXCEPTION : throw new AssertionError ( "exception should be thrown directly from parse()" ) ; case GOT_VALUE : case PARSE_COMPLET...
Processes the last token .
142,997
public static String asString ( byte id ) { switch ( id ) { case STOP : return "stop(0)" ; case VOID : return "void(1)" ; case BOOL : return "bool(2)" ; case BYTE : return "byte(3)" ; case DOUBLE : return "double(4)" ; case I16 : return "i16(6)" ; case I32 : return "i32(8)" ; case I64 : return "i64(10)" ; case STRING :...
Readable string value for a type ID .
142,998
public MediaItem getMediaItem ( String id ) { DailyMotionUrl url = new DailyMotionUrl ( requestPrefix + id ) ; HttpRequest request ; try { request = requestFactory . buildGetRequest ( url ) ; DailyMotionVideo video = request . execute ( ) . parseAs ( DailyMotionVideo . class ) ; if ( video != null ) { MediaItem mediaIt...
Returns the retrieved media item
142,999
String toAbsoluteFormat ( long time ) { calendar . setTime ( new Date ( time ) ) ; long hours = calendar . get ( Calendar . HOUR_OF_DAY ) ; StringBuffer buffer = new StringBuffer ( ) ; if ( hours < 10 ) { buffer . append ( '0' ) ; } buffer . append ( hours ) ; buffer . append ( ':' ) ; long minutes = calendar . get ( C...
Format as an absolute date time format that is