idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
35,900
static BlockCanaryInternals getInstance ( ) { if ( sInstance == null ) { synchronized ( BlockCanaryInternals . class ) { if ( sInstance == null ) { sInstance = new BlockCanaryInternals ( ) ; } } } return sInstance ; }
Get BlockCanaryInternals singleton
35,901
public static String save ( String str ) { String path ; synchronized ( SAVE_DELETE_LOCK ) { path = save ( "looper" , str ) ; } return path ; }
Save log to file
35,902
public static void cleanObsolete ( ) { HandlerThreadFactory . getWriteLogThreadHandler ( ) . post ( new Runnable ( ) { public void run ( ) { long now = System . currentTimeMillis ( ) ; File [ ] f = BlockCanaryInternals . getLogFiles ( ) ; if ( f != null && f . length > 0 ) { synchronized ( SAVE_DELETE_LOCK ) { for ( Fi...
Delete obsolete log files which is by default 2 days .
35,903
public String getCpuRateInfo ( ) { StringBuilder sb = new StringBuilder ( ) ; synchronized ( mCpuInfoEntries ) { for ( Map . Entry < Long , String > entry : mCpuInfoEntries . entrySet ( ) ) { long time = entry . getKey ( ) ; sb . append ( BlockInfo . TIME_FORMATTER . format ( time ) ) . append ( ' ' ) . append ( entry ...
Get cpu rate information
35,904
public void stop ( ) { if ( mMonitorStarted ) { mMonitorStarted = false ; Looper . getMainLooper ( ) . setMessageLogging ( null ) ; mBlockCanaryCore . stackSampler . stop ( ) ; mBlockCanaryCore . cpuSampler . stop ( ) ; } }
Stop monitoring .
35,905
public void recordStartTime ( ) { PreferenceManager . getDefaultSharedPreferences ( BlockCanaryContext . get ( ) . provideContext ( ) ) . edit ( ) . putLong ( "BlockCanary_StartTime" , System . currentTimeMillis ( ) ) . commit ( ) ; }
Record monitor start time to preference you may use it when after push which tells start BlockCanary .
35,906
public boolean isMonitorDurationEnd ( ) { long startTime = PreferenceManager . getDefaultSharedPreferences ( BlockCanaryContext . get ( ) . provideContext ( ) ) . getLong ( "BlockCanary_StartTime" , 0 ) ; return startTime != 0 && System . currentTimeMillis ( ) - startTime > BlockCanaryContext . get ( ) . provideMonitor...
Is monitor duration end compute from recordStartTime end provideMonitorDuration .
35,907
private HttpResponse directUpload ( GenericUrl initiationRequestUrl ) throws IOException { updateStateAndNotifyListener ( UploadState . MEDIA_IN_PROGRESS ) ; HttpContent content = mediaContent ; if ( metadata != null ) { content = new MultipartContent ( ) . setContentParts ( Arrays . asList ( metadata , mediaContent ) ...
Direct Uploads the media .
35,908
private HttpResponse resumableUpload ( GenericUrl initiationRequestUrl ) throws IOException { HttpResponse initialResponse = executeUploadInitiation ( initiationRequestUrl ) ; if ( ! initialResponse . isSuccessStatusCode ( ) ) { return initialResponse ; } GenericUrl uploadUrl ; try { uploadUrl = new GenericUrl ( initia...
Uploads the media in a resumable manner .
35,909
private HttpResponse executeUploadInitiation ( GenericUrl initiationRequestUrl ) throws IOException { updateStateAndNotifyListener ( UploadState . INITIATION_STARTED ) ; initiationRequestUrl . put ( "uploadType" , "resumable" ) ; HttpContent content = metadata == null ? new EmptyContent ( ) : metadata ; HttpRequest req...
This method sends a POST request with empty content to get the unique upload URL .
35,910
private HttpResponse executeCurrentRequestWithoutGZip ( HttpRequest request ) throws IOException { new MethodOverride ( ) . intercept ( request ) ; request . setThrowExceptionOnExecuteError ( false ) ; HttpResponse response = request . execute ( ) ; return response ; }
Executes the current request with some minimal common code .
35,911
private HttpResponse executeCurrentRequest ( HttpRequest request ) throws IOException { if ( ! disableGZipContent && ! ( request . getContent ( ) instanceof EmptyContent ) ) { request . setEncoding ( new GZipEncoding ( ) ) ; } HttpResponse response = executeCurrentRequestWithoutGZip ( request ) ; return response ; }
Executes the current request with some common code that includes exponential backoff and GZip encoding .
35,912
private ContentChunk buildContentChunk ( ) throws IOException { int blockSize ; if ( isMediaLengthKnown ( ) ) { blockSize = ( int ) Math . min ( chunkSize , getMediaContentLength ( ) - totalBytesServerReceived ) ; } else { blockSize = chunkSize ; } AbstractInputStreamContent contentChunk ; int actualBlockSize = blockSi...
Sets the HTTP media content chunk and the required headers that should be used in the upload request .
35,913
public MediaHttpUploader setInitiationRequestMethod ( String initiationRequestMethod ) { Preconditions . checkArgument ( initiationRequestMethod . equals ( HttpMethods . POST ) || initiationRequestMethod . equals ( HttpMethods . PUT ) || initiationRequestMethod . equals ( HttpMethods . PATCH ) ) ; this . initiationRequ...
Sets the HTTP method used for the initiation request .
35,914
private void updateStateAndNotifyListener ( UploadState uploadState ) throws IOException { this . uploadState = uploadState ; if ( progressListener != null ) { progressListener . progressChanged ( this ) ; } }
Sets the upload state and notifies the progress listener .
35,915
public static synchronized KeyStore getCertificateTrustStore ( ) throws IOException , GeneralSecurityException { if ( certTrustStore == null ) { certTrustStore = SecurityUtils . getJavaKeyStore ( ) ; InputStream keyStoreStream = GoogleUtils . class . getResourceAsStream ( "google.jks" ) ; SecurityUtils . loadKeyStore (...
Returns the key store for trusted root certificates to use for Google APIs .
35,916
private HttpResponse getFakeResponse ( final int statusCode , final InputStream partContent , List < String > headerNames , List < String > headerValues ) throws IOException { HttpRequest request = new FakeResponseHttpTransport ( statusCode , partContent , headerNames , headerValues ) . createRequestFactory ( ) . build...
Create a fake HTTP response object populated with the partContent and the statusCode .
35,917
public static GoogleAccountCredential usingOAuth2 ( Context context , Collection < String > scopes ) { Preconditions . checkArgument ( scopes != null && scopes . iterator ( ) . hasNext ( ) ) ; String scopesStr = "oauth2: " + Joiner . on ( ' ' ) . join ( scopes ) ; return new GoogleAccountCredential ( context , scopesSt...
Constructs a new instance using OAuth 2 . 0 scopes .
35,918
public static GoogleAccountCredential usingAudience ( Context context , String audience ) { Preconditions . checkArgument ( audience . length ( ) != 0 ) ; return new GoogleAccountCredential ( context , "audience:" + audience ) ; }
Sets the audience scope to use with Google Cloud Endpoints .
35,919
public final Intent newChooseAccountIntent ( ) { return AccountPicker . newChooseAccountIntent ( selectedAccount , null , new String [ ] { GoogleAccountManager . ACCOUNT_TYPE } , true , null , null , null , null ) ; }
Returns an intent to show the user to select a Google account or create a new one if there are none on the device yet .
35,920
public String getToken ( ) throws IOException , GoogleAuthException { if ( backOff != null ) { backOff . reset ( ) ; } while ( true ) { try { return GoogleAuthUtil . getToken ( context , accountName , scope ) ; } catch ( IOException e ) { try { if ( backOff == null || ! BackOffUtils . next ( sleeper , backOff ) ) { thr...
Returns an OAuth 2 . 0 access token .
35,921
public Details getDetails ( ) { Preconditions . checkArgument ( ( web == null ) != ( installed == null ) ) ; return web == null ? installed : web ; }
Returns the details for either installed or web applications .
35,922
private HttpResponse executeCurrentRequest ( long currentRequestLastBytePos , GenericUrl requestUrl , HttpHeaders requestHeaders , OutputStream outputStream ) throws IOException { HttpRequest request = requestFactory . buildGetRequest ( requestUrl ) ; if ( requestHeaders != null ) { request . getHeaders ( ) . putAll ( ...
Executes the current request .
35,923
private void updateStateAndNotifyListener ( DownloadState downloadState ) throws IOException { this . downloadState = downloadState ; if ( progressListener != null ) { progressListener . progressChanged ( this ) ; } }
Sets the download state and notifies the progress listener .
35,924
public void execute ( ) throws IOException { boolean retryAllowed ; Preconditions . checkState ( ! requestInfos . isEmpty ( ) ) ; HttpRequest batchRequest = requestFactory . buildPostRequest ( this . batchUrl , null ) ; HttpExecuteInterceptor originalInterceptor = batchRequest . getInterceptor ( ) ; batchRequest . setI...
Executes all queued HTTP requests in a single call parses the responses and invokes callbacks .
35,925
public final List < PublicKey > getPublicKeys ( ) throws GeneralSecurityException , IOException { lock . lock ( ) ; try { if ( publicKeys == null || clock . currentTimeMillis ( ) + REFRESH_SKEW_MILLIS > expirationTimeMilliseconds ) { refresh ( ) ; } return publicKeys ; } finally { lock . unlock ( ) ; } }
Returns an unmodifiable view of the public keys .
35,926
long getCacheTimeInSec ( HttpHeaders httpHeaders ) { long cacheTimeInSec = 0 ; if ( httpHeaders . getCacheControl ( ) != null ) { for ( String arg : httpHeaders . getCacheControl ( ) . split ( "," ) ) { Matcher m = MAX_AGE_PATTERN . matcher ( arg ) ; if ( m . matches ( ) ) { cacheTimeInSec = Long . parseLong ( m . grou...
Gets the cache time in seconds . max - age in Cache - Control header and Age header are considered .
35,927
public StoredChannel store ( DataStore < StoredChannel > dataStore ) throws IOException { lock . lock ( ) ; try { dataStore . set ( getId ( ) , this ) ; return this ; } finally { lock . unlock ( ) ; } }
Stores this notification channel in the given notification channel data store .
35,928
protected final void initializeMediaUpload ( AbstractInputStreamContent mediaContent ) { HttpRequestFactory requestFactory = abstractGoogleClient . getRequestFactory ( ) ; this . uploader = new MediaHttpUploader ( mediaContent , requestFactory . getTransport ( ) , requestFactory . getInitializer ( ) ) ; this . uploader...
Initializes the media HTTP uploader based on the media content .
35,929
protected final void initializeMediaDownload ( ) { HttpRequestFactory requestFactory = abstractGoogleClient . getRequestFactory ( ) ; this . downloader = new MediaHttpDownloader ( requestFactory . getTransport ( ) , requestFactory . getInitializer ( ) ) ; }
Initializes the media HTTP downloader .
35,930
private HttpRequest buildHttpRequest ( boolean usingHead ) throws IOException { Preconditions . checkArgument ( uploader == null ) ; Preconditions . checkArgument ( ! usingHead || requestMethod . equals ( HttpMethods . GET ) ) ; String requestMethodToUse = usingHead ? HttpMethods . HEAD : requestMethod ; final HttpRequ...
Create a request suitable for use against this service .
35,931
public final < E > void queue ( BatchRequest batchRequest , Class < E > errorClass , BatchCallback < T , E > callback ) throws IOException { Preconditions . checkArgument ( uploader == null , "Batching media requests is not supported" ) ; batchRequest . queue ( buildHttpRequest ( ) , getResponseClass ( ) , errorClass ,...
Queues the request into the specified batch request container using the specified error class .
35,932
@ SuppressWarnings ( "unchecked" ) public AbstractGoogleClientRequest < T > set ( String fieldName , Object value ) { return ( AbstractGoogleClientRequest < T > ) super . set ( fieldName , value ) ; }
for more details
35,933
public static GoogleJsonError parse ( JsonFactory jsonFactory , HttpResponse response ) throws IOException { JsonObjectParser jsonObjectParser = new JsonObjectParser . Builder ( jsonFactory ) . setWrapperKeys ( Collections . singleton ( "error" ) ) . build ( ) ; return jsonObjectParser . parseAndClose ( response . getC...
Parses the given error HTTP response using the given JSON factory .
35,934
public void initialize ( AbstractGoogleClientRequest < ? > request ) throws IOException { if ( key != null ) { request . put ( "key" , key ) ; } if ( userIp != null ) { request . put ( "userIp" , userIp ) ; } }
Subclasses should call super implementation in order to set the key and userIp .
35,935
public void setEntryClasses ( Class < ? > ... entryClasses ) { int numEntries = entryClasses . length ; HashMap < String , Class < ? > > kindToEntryClassMap = this . kindToEntryClassMap ; for ( int i = 0 ; i < numEntries ; i ++ ) { Class < ? > entryClass = entryClasses [ i ] ; ClassInfo typeInfo = ClassInfo . of ( entr...
Sets the entry classes to use when parsing .
35,936
public static < T , E > MultiKindFeedParser < T > create ( HttpResponse response , XmlNamespaceDictionary namespaceDictionary , Class < T > feedClass , Class < E > ... entryClasses ) throws IOException , XmlPullParserException { InputStream content = response . getContent ( ) ; try { Atom . checkContentType ( response ...
Parses the given HTTP response using the given feed class and entry classes .
35,937
protected TransactionTypeEnum getType ( byte logstate ) { switch ( ( logstate & 0x60 ) >> 5 ) { case 0 : return TransactionTypeEnum . LOADED ; case 1 : return TransactionTypeEnum . UNLOADED ; case 2 : return TransactionTypeEnum . PURCHASE ; case 3 : return TransactionTypeEnum . REFUND ; } return null ; }
Method used to get the transaction type
35,938
protected void extractEF_ID ( final Application pApplication ) throws CommunicationException { byte [ ] data = template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum . READ_RECORD , 0x01 , 0xBC , 0 ) . toBytes ( ) ) ; if ( ResponseUtils . isSucceed ( data ) ) { pApplication . setReadingStep (...
Method used to extract Ef_iD record
35,939
private Collection < AnnotationData > getAnnotationSet ( final Collection < TagAndLength > pTags ) { Collection < AnnotationData > ret = null ; if ( pTags != null ) { Map < ITag , AnnotationData > data = AnnotationUtils . getInstance ( ) . getMap ( ) . get ( getClass ( ) . getName ( ) ) ; ret = new ArrayList < Annotati...
Method to get the annotation set from the current class
35,940
public void parse ( final byte [ ] pData , final Collection < TagAndLength > pTags ) { Collection < AnnotationData > set = getAnnotationSet ( pTags ) ; BitUtils bit = new BitUtils ( pData ) ; Iterator < AnnotationData > it = set . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationData data = it . next ( ) ; if ( da...
Method to parse byte data
35,941
protected void setField ( final Field field , final IFile pData , final Object pValue ) { if ( field != null ) { try { field . set ( pData , pValue ) ; } catch ( IllegalArgumentException e ) { LOGGER . error ( "Parameters of fied.set are not valid" , e ) ; } catch ( IllegalAccessException e ) { LOGGER . error ( "Imposs...
Method used to set the value of a field
35,942
public static final Collection < String > getDescription ( final String pAtr ) { Collection < String > ret = null ; if ( StringUtils . isNotBlank ( pAtr ) ) { String val = StringUtils . deleteWhitespace ( pAtr ) . toUpperCase ( ) ; for ( String key : MAP . keySet ( ) ) { if ( val . matches ( "^" + key + "$" ) ) { ret =...
Method used to find description from ATR
35,943
public static EmvTrack2 extractTrack2EquivalentData ( final byte [ ] pRawTrack2 ) { EmvTrack2 ret = null ; if ( pRawTrack2 != null ) { EmvTrack2 track2 = new EmvTrack2 ( ) ; track2 . setRaw ( pRawTrack2 ) ; String data = BytesUtils . bytesToStringNoSpace ( pRawTrack2 ) ; Matcher m = TRACK2_EQUIVALENT_PATTERN . matcher ...
Extract track 2 Equivalent data
35,944
public static EmvTrack1 extractTrack1Data ( final byte [ ] pRawTrack1 ) { EmvTrack1 ret = null ; if ( pRawTrack1 != null ) { EmvTrack1 track1 = new EmvTrack1 ( ) ; track1 . setRaw ( pRawTrack1 ) ; Matcher m = TRACK1_PATTERN . matcher ( new String ( pRawTrack1 ) ) ; if ( m . find ( ) ) { track1 . setFormatCode ( m . gro...
Extract track 1 data
35,945
public void initFromAnnotation ( final Data pData ) { dateStandard = pData . dateStandard ( ) ; format = pData . format ( ) ; index = pData . index ( ) ; readHexa = pData . readHexa ( ) ; size = pData . size ( ) ; if ( pData . tag ( ) != null ) { tag = EmvTags . find ( BytesUtils . fromString ( pData . tag ( ) ) ) ; } ...
Initialization from annotation
35,946
public static CPLC parse ( byte [ ] raw ) { CPLC ret = null ; if ( raw != null ) { byte [ ] cplc = null ; if ( raw . length == CPLC . SIZE + 2 ) { cplc = raw ; } else if ( raw . length == CPLC . SIZE + 5 ) { cplc = TlvUtil . getValue ( raw , CPLC_TAG ) ; } else { LOGGER . error ( "CPLC data not valid" ) ; return null ;...
Method used to parse and extract CPLC data
35,947
public static boolean contains ( final byte [ ] pByte , final SwEnum ... pEnum ) { SwEnum val = SwEnum . getSW ( pByte ) ; if ( LOGGER . isDebugEnabled ( ) && pByte != null ) { LOGGER . debug ( "Response Status <" + BytesUtils . bytesToStringNoSpace ( Arrays . copyOfRange ( pByte , Math . max ( pByte . length - 2 , 0 )...
Method used to check equality with the last command return SW1SW2 == pEnum
35,948
protected boolean extractPublicData ( final Application pApplication ) throws CommunicationException { boolean ret = false ; byte [ ] data = selectAID ( pApplication . getAid ( ) ) ; if ( ResponseUtils . contains ( data , SwEnum . SW_9000 , SwEnum . SW_6285 ) ) { pApplication . setReadingStep ( ApplicationStepEnum . SE...
Read public card data from parameter AID
35,949
protected EmvCardScheme findCardScheme ( final String pAid , final String pCardNumber ) { EmvCardScheme type = EmvCardScheme . getCardTypeByAid ( pAid ) ; if ( type == EmvCardScheme . CB ) { type = EmvCardScheme . getCardTypeByCardNumber ( pCardNumber ) ; if ( type != null ) { LOGGER . debug ( "Real type:" + type . get...
Method used to find the real card scheme
35,950
protected boolean parse ( final byte [ ] pSelectResponse , final Application pApplication ) throws CommunicationException { boolean ret = false ; byte [ ] logEntry = getLogEntry ( pSelectResponse ) ; byte [ ] pdol = TlvUtil . getValue ( pSelectResponse , EmvTags . PDOL ) ; byte [ ] gpo = getGetProcessingOptions ( pdol ...
Method used to parse EMV card
35,951
protected boolean extractCommonsCardData ( final byte [ ] pGpo ) throws CommunicationException { boolean ret = false ; byte data [ ] = TlvUtil . getValue ( pGpo , EmvTags . RESPONSE_MESSAGE_TEMPLATE_1 ) ; if ( data != null ) { data = ArrayUtils . subarray ( data , 2 , data . length ) ; } else { ret = extractTrackData (...
Method used to extract commons card data
35,952
protected List < Afl > extractAfl ( final byte [ ] pAfl ) { List < Afl > list = new ArrayList < Afl > ( ) ; ByteArrayInputStream bai = new ByteArrayInputStream ( pAfl ) ; while ( bai . available ( ) >= 4 ) { Afl afl = new Afl ( ) ; afl . setSfi ( bai . read ( ) >> 3 ) ; afl . setFirstRecord ( bai . read ( ) ) ; afl . s...
Extract list of application file locator from Afl response
35,953
protected byte [ ] getGetProcessingOptions ( final byte [ ] pPdol ) throws CommunicationException { List < TagAndLength > list = TlvUtil . parseTagAndLength ( pPdol ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; try { out . write ( EmvTags . COMMAND_TEMPLATE . getTagBytes ( ) ) ; out . write ( TlvUtil ...
Method used to create GPO command and execute it
35,954
protected boolean extractTrackData ( final EmvCard pEmvCard , final byte [ ] pData ) { template . get ( ) . getCard ( ) . setTrack1 ( TrackUtils . extractTrack1Data ( TlvUtil . getValue ( pData , EmvTags . TRACK1_DATA ) ) ) ; template . get ( ) . getCard ( ) . setTrack2 ( TrackUtils . extractTrack2EquivalentData ( TlvU...
Method used to extract track data from response
35,955
private void extractAnnotation ( ) { for ( Class < ? extends IFile > clazz : LISTE_CLASS ) { Map < ITag , AnnotationData > maps = new HashMap < ITag , AnnotationData > ( ) ; Set < AnnotationData > set = new TreeSet < AnnotationData > ( ) ; Field [ ] fields = clazz . getDeclaredFields ( ) ; for ( Field field : fields ) ...
Method to extract all annotation information and store them in the map
35,956
public String getHolderLastname ( ) { String ret = holderLastname ; if ( ret == null && track1 != null ) { ret = track1 . getHolderLastname ( ) ; } return ret ; }
Method used to get the field holderLastname
35,957
public String getHolderFirstname ( ) { String ret = holderFirstname ; if ( ret == null && track1 != null ) { ret = track1 . getHolderFirstname ( ) ; } return ret ; }
Method used to get the field holderFirstname
35,958
public String getCardNumber ( ) { String ret = null ; if ( track2 != null ) { ret = track2 . getCardNumber ( ) ; } if ( ret == null && track1 != null ) { ret = track1 . getCardNumber ( ) ; } return ret ; }
Method used to get the field cardNumber
35,959
public Date getExpireDate ( ) { Date ret = null ; if ( track2 != null ) { ret = track2 . getExpireDate ( ) ; } if ( ret == null && track1 != null ) { ret = track1 . getExpireDate ( ) ; } return ret ; }
Method used to get the field expireDate
35,960
private static String getTagValueAsString ( final ITag tag , final byte [ ] value ) { StringBuilder buf = new StringBuilder ( ) ; switch ( tag . getTagValueType ( ) ) { case TEXT : buf . append ( "=" ) ; buf . append ( new String ( value ) ) ; break ; case NUMERIC : buf . append ( "NUMERIC" ) ; break ; case BINARY : bu...
Method used get Tag value as String
35,961
public static List < TagAndLength > parseTagAndLength ( final byte [ ] data ) { List < TagAndLength > tagAndLengthList = new ArrayList < TagAndLength > ( ) ; if ( data != null ) { TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( data ) ) ; try { while ( stream . available ( ) > 0 ) { if ( stream ...
Method used to parser Tag and length
35,962
public static List < TLV > getlistTLV ( final byte [ ] pData , final ITag ... pTag ) { List < TLV > list = new ArrayList < TLV > ( ) ; TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( pData ) ) ; try { while ( stream . available ( ) > 0 ) { TLV tlv = TlvUtil . getNextTLV ( stream ) ; if ( tlv == ...
Method used to get the list of TLV corresponding to tags specified in parameters
35,963
public static byte [ ] getValue ( final byte [ ] pData , final ITag ... pTag ) { byte [ ] ret = null ; if ( pData != null ) { TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( pData ) ) ; try { while ( stream . available ( ) > 0 ) { TLV tlv = TlvUtil . getNextTLV ( stream ) ; if ( tlv == null ) { ...
Method used to get Tag value
35,964
public static int getLength ( final List < TagAndLength > pList ) { int ret = 0 ; if ( pList != null ) { for ( TagAndLength tl : pList ) { ret += tl . getLength ( ) ; } } return ret ; }
Method used to get length of all Tags
35,965
private void addDefaultParsers ( ) { parsers = new ArrayList < IParser > ( ) ; parsers . add ( new GeldKarteParser ( this ) ) ; parsers . add ( new EmvParser ( this ) ) ; }
Add default parser implementation
35,966
public EmvTemplate addParsers ( final IParser ... pParsers ) { if ( pParsers != null ) { for ( IParser parser : pParsers ) { parsers . add ( 0 , parser ) ; } } return this ; }
Method used to add a list of parser to the current EMV template
35,967
public EmvCard readEmvCard ( ) throws CommunicationException { if ( config . readCplc ) { readCPLCInfos ( ) ; } if ( config . readAt ) { card . setAt ( BytesUtils . bytesToStringNoSpace ( provider . getAt ( ) ) ) ; card . setAtrDescription ( config . contactLess ? AtrUtils . getDescriptionFromAts ( card . getAt ( ) ) :...
Method used to read public data from EMV card
35,968
protected boolean readWithPSE ( ) throws CommunicationException { boolean ret = false ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Try to read card with Payment System Environment" ) ; } byte [ ] data = selectPaymentEnvironment ( ) ; if ( ResponseUtils . isSucceed ( data ) ) { card . getApplications ( ) . a...
Read EMV card with Payment System Environment or Proximity Payment System Environment
35,969
protected List < Application > parseFCIProprietaryTemplate ( final byte [ ] pData ) throws CommunicationException { List < Application > ret = new ArrayList < Application > ( ) ; byte [ ] data = TlvUtil . getValue ( pData , EmvTags . SFI ) ; if ( data != null ) { int sfi = BytesUtils . byteArrayToInt ( data ) ; if ( LO...
Method used to parse FCI Proprietary Template
35,970
protected void readWithAID ( ) throws CommunicationException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Try to read card with AID" ) ; } Application app = new Application ( ) ; for ( EmvCardScheme type : EmvCardScheme . values ( ) ) { for ( byte [ ] aid : type . getAidByte ( ) ) { app . setAid ( aid ) ; a...
Read EMV card with AID
35,971
protected byte [ ] selectPaymentEnvironment ( ) throws CommunicationException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Select " + ( config . contactLess ? "PPSE" : "PSE" ) + " Application" ) ; } return provider . transceive ( new CommandApdu ( CommandEnum . SELECT , config . contactLess ? PPSE : PSE , 0...
Method used to select payment environment PSE or PPSE
35,972
protected byte [ ] selectAID ( final byte [ ] pAid ) throws CommunicationException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Select AID: " + BytesUtils . bytesToString ( pAid ) ) ; } return template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum . SELECT , pAid , 0 ) . toBytes (...
Select application with AID or RID
35,973
protected String extractApplicationLabel ( final byte [ ] pData ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Extract Application label" ) ; } String label = null ; byte [ ] labelByte = TlvUtil . getValue ( pData , EmvTags . APPLICATION_PREFERRED_NAME ) ; if ( labelByte == null ) { labelByte = TlvUtil . ge...
Method used to extract application label
35,974
protected void extractCardHolderName ( final byte [ ] pData ) { byte [ ] cardHolderByte = TlvUtil . getValue ( pData , EmvTags . CARDHOLDER_NAME ) ; if ( cardHolderByte != null ) { String [ ] name = StringUtils . split ( new String ( cardHolderByte ) . trim ( ) , TrackUtils . CARD_HOLDER_NAME_SEPARATOR ) ; if ( name !=...
Extract card holder lastname and firstname
35,975
protected int getTransactionCounter ( ) throws CommunicationException { int ret = UNKNOW ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Get Transaction Counter ATC" ) ; } byte [ ] data = template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum . GET_DATA , 0x9F , 0x36 , 0 ) . toBytes ...
Method used to get Transaction counter
35,976
protected List < TagAndLength > getLogFormat ( ) throws CommunicationException { List < TagAndLength > ret = new ArrayList < TagAndLength > ( ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "GET log format" ) ; } byte [ ] data = template . get ( ) . getProvider ( ) . transceive ( new CommandApdu ( CommandEnum...
Method used to get log format
35,977
protected List < EmvTransactionRecord > extractLogEntry ( final byte [ ] pLogEntry ) throws CommunicationException { List < EmvTransactionRecord > listRecord = new ArrayList < EmvTransactionRecord > ( ) ; if ( template . get ( ) . getConfig ( ) . readTransactions && pLogEntry != null ) { List < TagAndLength > tals = ge...
Method used to extract log entry from card
35,978
private static Date getDate ( final AnnotationData pAnnotation , final BitUtils pBit ) { Date date = null ; if ( pAnnotation . getDateStandard ( ) == BCD_DATE ) { date = pBit . getNextDate ( pAnnotation . getSize ( ) , pAnnotation . getFormat ( ) , true ) ; } else if ( pAnnotation . getDateStandard ( ) == CPCL_DATE ) {...
Method to get a date from the bytes array
35,979
public static Object getObject ( final AnnotationData pAnnotation , final BitUtils pBit ) { Object obj = null ; Class < ? > clazz = pAnnotation . getField ( ) . getType ( ) ; if ( clazz . equals ( Integer . class ) ) { obj = getInteger ( pAnnotation , pBit ) ; } else if ( clazz . equals ( Float . class ) ) { obj = getF...
Method to read and object from the bytes tab
35,980
private static Float getFloat ( final AnnotationData pAnnotation , final BitUtils pBit ) { Float ret = null ; if ( BCD_FORMAT . equals ( pAnnotation . getFormat ( ) ) ) { ret = Float . parseFloat ( pBit . getNextHexaString ( pAnnotation . getSize ( ) ) ) ; } else { ret = ( float ) getInteger ( pAnnotation , pBit ) ; } ...
Method use to get float
35,981
@ SuppressWarnings ( "unchecked" ) private static IKeyEnum getEnum ( final AnnotationData pAnnotation , final BitUtils pBit ) { int val = 0 ; try { val = Integer . parseInt ( pBit . getNextHexaString ( pAnnotation . getSize ( ) ) , pAnnotation . isReadHexa ( ) ? 16 : 10 ) ; } catch ( NumberFormatException nfe ) { } ret...
This method is used to get an enum with his key
35,982
@ SuppressWarnings ( "unchecked" ) public static < T extends IKeyEnum > T getValue ( final int pKey , final Class < T > pClass ) { for ( IKeyEnum val : pClass . getEnumConstants ( ) ) { if ( val . getKey ( ) == pKey ) { return ( T ) val ; } } LOGGER . error ( "Unknow value:" + pKey + " for Enum:" + pClass . getName ( )...
Get the value of and enum from his key
35,983
public static int [ ] getHashBuckets ( String key , int hashCount , int max , boolean applyWidth ) { byte [ ] b ; b = key . getBytes ( StandardCharsets . UTF_8 ) ; return getHashBuckets ( b , hashCount , max , applyWidth ) ; }
than performing further iterations of murmur .
35,984
private void status ( final String [ ] args ) throws FileNotFoundException { setWorkingDir ( args ) ; final Path statusFile = this . workingDir . resolve ( this . statusName ) ; readStatus ( true , statusFile ) ; if ( args . length > 2 && args [ 2 ] . equalsIgnoreCase ( "verbose" ) ) { System . out . println ( this . s...
Prints the status of the node running in the configured working directory .
35,985
public static int computeBestK ( int bucketsPerElement ) { assert bucketsPerElement >= 0 ; if ( bucketsPerElement >= optKPerBuckets . length ) { return optKPerBuckets [ optKPerBuckets . length - 1 ] ; } return optKPerBuckets [ bucketsPerElement ] ; }
Given the number of buckets that can be used per element return the optimal number of hash functions in order to minimize the false positive rate .
35,986
public Iterable < JsonObject > convertRecord ( JsonArray outputSchema , String strInputRecord , WorkUnitState workUnit ) throws DataConversionException { JsonParser jsonParser = new JsonParser ( ) ; JsonObject inputRecord = ( JsonObject ) jsonParser . parse ( strInputRecord ) ; if ( ! this . unpackComplexSchemas ) { re...
Takes in a record with format String and Uses the inputSchema to convert the record to a JsonObject
35,987
private JsonElement parseEnumType ( JsonSchema schema , JsonElement value ) throws DataConversionException { if ( schema . getSymbols ( ) . contains ( value ) ) { return value ; } throw new DataConversionException ( "Invalid symbol: " + value . getAsString ( ) + " allowed values: " + schema . getSymbols ( ) . toString ...
Parses Enum type values
35,988
private JsonElement parseJsonArrayType ( JsonSchema schema , JsonElement value ) throws DataConversionException { Type arrayType = schema . getTypeOfArrayItems ( ) ; JsonArray tempArray = new JsonArray ( ) ; if ( Type . isPrimitive ( arrayType ) ) { return value ; } JsonSchema nestedSchema = schema . getItemsWithinData...
Parses JsonArray type values
35,989
private JsonElement parseJsonObjectType ( JsonSchema schema , JsonElement value ) throws DataConversionException { JsonSchema valuesWithinDataType = schema . getValuesWithinDataType ( ) ; if ( schema . isType ( MAP ) ) { if ( Type . isPrimitive ( valuesWithinDataType . getType ( ) ) ) { return value ; } JsonObject map ...
Parses JsonObject type values
35,990
private JsonElement parsePrimitiveType ( JsonSchema schema , JsonElement value ) throws DataConversionException { if ( ( schema . isType ( NULL ) || schema . isNullable ( ) ) && value . isJsonNull ( ) ) { return JsonNull . INSTANCE ; } if ( ( schema . isType ( NULL ) && ! value . isJsonNull ( ) ) || ( ! schema . isType...
Parses primitive types
35,991
public static boolean isAncestor ( Path possibleAncestor , Path fullPath ) { return ! relativizePath ( fullPath , possibleAncestor ) . equals ( getPathWithoutSchemeAndAuthority ( fullPath ) ) ; }
Checks whether possibleAncestor is an ancestor of fullPath .
35,992
public static Path getPathWithoutSchemeAndAuthority ( Path path ) { return new Path ( null , null , path . toUri ( ) . getPath ( ) ) ; }
Removes the Scheme and Authority from a Path .
35,993
public static Path getRootPath ( Path path ) { if ( path . isRoot ( ) ) { return path ; } return getRootPath ( path . getParent ( ) ) ; }
Returns the root path for the specified path .
35,994
public static Path withoutLeadingSeparator ( Path path ) { return new Path ( StringUtils . removeStart ( path . toString ( ) , Path . SEPARATOR ) ) ; }
Removes the leading slash if present .
35,995
public static Path deepestNonGlobPath ( Path input ) { Path commonRoot = input ; while ( commonRoot != null && isGlob ( commonRoot ) ) { commonRoot = commonRoot . getParent ( ) ; } return commonRoot ; }
Finds the deepest ancestor of input that is not a glob .
35,996
public static void deleteEmptyParentDirectories ( FileSystem fs , Path limitPath , Path startPath ) throws IOException { if ( PathUtils . isAncestor ( limitPath , startPath ) && ! PathUtils . getPathWithoutSchemeAndAuthority ( limitPath ) . equals ( PathUtils . getPathWithoutSchemeAndAuthority ( startPath ) ) && fs . l...
Deletes empty directories starting with startPath and all ancestors up to but not including limitPath .
35,997
public static Optional < Path > getPersistDir ( State state ) throws IOException { if ( state . contains ( PERSIST_DIR_KEY ) ) { return Optional . of ( new Path ( state . getProp ( PERSIST_DIR_KEY ) , UserGroupInformation . getCurrentUser ( ) . getShortUserName ( ) ) ) ; } return Optional . absent ( ) ; }
Get the persist directory for this job .
35,998
public boolean persistFile ( State state , CopyableFile file , Path path ) throws IOException { if ( ! this . persistDir . isPresent ( ) ) { return false ; } String guid = computeGuid ( state , file ) ; Path guidPath = new Path ( this . persistDir . get ( ) , guid ) ; if ( ! this . fs . exists ( guidPath ) ) { this . f...
Moves a copied path into a persistent location managed by gobblin - distcp . This method is used when an already copied file cannot be successfully published . In future runs instead of re - copying the file distcp will use the persisted file .
35,999
static String shortenPathName ( Path path , int bytes ) { String pathString = path . toUri ( ) . getPath ( ) ; String replaced = pathString . replace ( "/" , "_" ) ; if ( replaced . length ( ) <= bytes ) { return replaced ; } int bytesPerHalf = ( bytes - 3 ) / 2 ; return replaced . substring ( 0 , bytesPerHalf ) + "......
Shorten an absolute path into a sanitized String of length at most bytes . This is useful for including a summary of an absolute path in a file name .