_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q155400
Hawk.init
train
public static HawkBuilder init(Context context) { HawkUtils.checkNull("Context", context); hawkFacade = null; return new HawkBuilder(context); }
java
{ "resource": "" }
q155401
Hawk.put
train
public static <T> boolean put(String key, T value) { return hawkFacade.put(key, value); }
java
{ "resource": "" }
q155402
Hawk.get
train
public static <T> T get(String key, T defaultValue) { return hawkFacade.get(key, defaultValue); }
java
{ "resource": "" }
q155403
FlatButton.setBackgroundCompat
train
@SuppressWarnings("deprecation") @SuppressLint("NewApi") public void setBackgroundCompat(Drawable drawable) { int pL = getPaddingLeft(); int pT = getPaddingTop(); int pR = getPaddingRight(); int pB = getPaddingBottom(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JE...
java
{ "resource": "" }
q155404
KenBurnsView.startNewTransition
train
private void startNewTransition() { if (!hasBounds()) { return; // Can't start transition if the drawable has no bounds. } mCurrentTrans = mTransGen.generateNextTransition(mDrawableRect, mViewportRect); mElapsedTime = 0; mLastFrameTime = System.currentTimeMillis(); ...
java
{ "resource": "" }
q155405
KenBurnsView.restart
train
public void restart() { int width = getWidth(); int height = getHeight(); if (width == 0 || height == 0) { return; // Can't call restart() when view area is zero. } updateViewport(width, height); updateDrawableBounds(); startNewTransition(); }
java
{ "resource": "" }
q155406
KenBurnsView.updateDrawableBounds
train
private void updateDrawableBounds() { if (mDrawableRect == null) { mDrawableRect = new RectF(); } Drawable d = getDrawable(); if (d != null && d.getIntrinsicHeight() > 0 && d.getIntrinsicWidth() > 0) { mDrawableRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicH...
java
{ "resource": "" }
q155407
Transition.getInterpolatedRect
train
public RectF getInterpolatedRect(long elapsedTime) { float elapsedTimeFraction = elapsedTime / (float) mDuration; float interpolationProgress = Math.min(elapsedTimeFraction, 1); float interpolation = mInterpolator.getInterpolation(interpolationProgress); float currentWidth = mSrcRect.wid...
java
{ "resource": "" }
q155408
SignalServiceMessagePipe.read
train
public SignalServiceEnvelope read(long timeout, TimeUnit unit) throws InvalidVersionException, IOException, TimeoutException { return read(timeout, unit, new NullMessagePipeCallback()); }
java
{ "resource": "" }
q155409
SignalServiceMessageSender.sendReceipt
train
public void sendReceipt(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceReceiptMessage message) throws IOException, UntrustedIdentityException { byte[] content = createReceiptContent(message); sendMess...
java
{ "resource": "" }
q155410
SignalServiceMessageSender.sendTyping
train
public void sendTyping(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceTypingMessage message) throws IOException, UntrustedIdentityException { byte[] content = createTypingContent(message); sendMessage(r...
java
{ "resource": "" }
q155411
SignalServiceMessageSender.sendCallMessage
train
public void sendCallMessage(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceCallMessage message) throws IOException, UntrustedIdentityException { byte[] content = createCallContent(message); sen...
java
{ "resource": "" }
q155412
SignalServiceMessageSender.sendMessage
train
public SendMessageResult sendMessage(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceDataMessage message) throws UntrustedIdentityException, IOException { byte[...
java
{ "resource": "" }
q155413
SignalServiceMessageSender.sendMessage
train
public List<SendMessageResult> sendMessage(List<SignalServiceAddress> recipients, List<Optional<UnidentifiedAccessPair>> unidentifiedAccess, SignalServiceDataMessage message) throws IOException, Unt...
java
{ "resource": "" }
q155414
SignalServiceMessageReceiver.createMessagePipe
train
public SignalServiceMessagePipe createMessagePipe() { WebSocketConnection webSocket = new WebSocketConnection(urls.getSignalServiceUrls()[0].getUrl(), urls.getSignalServiceUrls()[0].getTrustStore(), ...
java
{ "resource": "" }
q155415
SignalServiceAccountManager.requestSmsVerificationCode
train
public void requestSmsVerificationCode(boolean androidSmsRetrieverSupported, Optional<String> captchaToken) throws IOException { this.pushServiceSocket.requestSmsVerificationCode(androidSmsRetrieverSupported, captchaToken); }
java
{ "resource": "" }
q155416
SignalServiceAccountManager.requestVoiceVerificationCode
train
public void requestVoiceVerificationCode(Locale locale, Optional<String> captchaToken) throws IOException { this.pushServiceSocket.requestVoiceVerificationCode(locale, captchaToken); }
java
{ "resource": "" }
q155417
SignalServiceAccountManager.verifyAccountWithCode
train
public void verifyAccountWithCode(String verificationCode, String signalingKey, int signalProtocolRegistrationId, boolean fetchesMessages, String pin, byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess) throws IOException { this.pushServiceSocket.verifyA...
java
{ "resource": "" }
q155418
SignalServiceAccountManager.setAccountAttributes
train
public void setAccountAttributes(String signalingKey, int signalProtocolRegistrationId, boolean fetchesMessages, String pin, byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess) throws IOException { this.pushServiceSocket.setAccountAttributes(signalingKey,...
java
{ "resource": "" }
q155419
SignalServiceAccountManager.setPreKeys
train
public void setPreKeys(IdentityKey identityKey, SignedPreKeyRecord signedPreKey, List<PreKeyRecord> oneTimePreKeys) throws IOException { this.pushServiceSocket.registerPreKeys(identityKey, signedPreKey, oneTimePreKeys); }
java
{ "resource": "" }
q155420
SignalServiceAccountManager.getContact
train
public Optional<ContactTokenDetails> getContact(String e164number) throws IOException { String contactToken = createDirectoryServerToken(e164number, true); ContactTokenDetails contactTokenDetails = this.pushServiceSocket.getContactTokenDetails(contactToken); if (contactTokenDetails != n...
java
{ "resource": "" }
q155421
SignalServiceAccountManager.getContacts
train
public List<ContactTokenDetails> getContacts(Set<String> e164numbers) throws IOException { Map<String, String> contactTokensMap = createDirectoryServerTokenMap(e164numbers); List<ContactTokenDetails> activeTokens = this.pushServiceSocket.retrieveDirectory(contactTokensMap.keySet()); for (...
java
{ "resource": "" }
q155422
KieServerGateway.getContainer
train
@SuppressWarnings("unchecked") public KieContainerResource getContainer(String serverUrl, String container) { // in case of container is not instantiated the response doesn't parse ServiceResponse String response = client.target(serverUrl) .path("containers") .path(container...
java
{ "resource": "" }
q155423
EventFeeder.feed
train
public void feed() { if ( source.hasNext() ) { Event< ? > event = source.getNext(); FeedContext context = new FeedContext( event ); FeedTrigger trigger = new FeedTrigger(); trigger.setNextFireTime( event.getDate() ); FeedJob job = new FeedJob( source, ...
java
{ "resource": "" }
q155424
CellGridCanvas.update
train
public void update(final Graphics g) { final Dimension d = getSize(); if ( (this.offScreenImage == null) ) { this.offScreenImage = createImage( d.width, d.height ); } paint( this.offScreenImage.getGraphics() ); g.drawImage( th...
java
{ "resource": "" }
q155425
CellGridCanvas.paint
train
public void paint(final Graphics g) { // Draw grid on background image, which is faster final int numberOfColumns = this.cellGrid.getNumberOfColumns(); final int numberOfRows = this.cellGrid.getNumberOfRows(); if ( this.backgroundImage == null ) { final Dimension d = getSize(...
java
{ "resource": "" }
q155426
CellGridCanvas.getPreferredSize
train
public Dimension getPreferredSize() { final int numberOfColumns = this.cellGrid.getNumberOfColumns(); final int numberOfRows = this.cellGrid.getNumberOfRows(); return new Dimension( this.cellSize * numberOfColumns, this.cellSize * numberOfRows ); }
java
{ "resource": "" }
q155427
AnnotationsUtil.registerAnnotationConfigProcessors
train
public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors( BeanDefinitionRegistry registry, Object source, ReleaseId releaseId) { Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<BeanDefinitionHolder>(1); if (!registry.containsBeanDefinition(KIE_ANNOTATION_PROCESSOR_...
java
{ "resource": "" }
q155428
Base64Util.encode
train
public static String encode( String string ) { byte[] bytes; try { bytes = string.getBytes(PREFERRED_ENCODING); } catch( UnsupportedEncodingException uee ) { bytes = string.getBytes(); } return encodeBytes(bytes); }
java
{ "resource": "" }
q155429
DMNServicesClientImpl.evaluateDecisions
train
public ServiceResponse<DMNResult> evaluateDecisions(String containerId, DMNContextKS payload) { ServiceResponse<DMNResult> result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId...
java
{ "resource": "" }
q155430
AcceptHeaders.getMediaTypeQualityValues
train
public static Map<MediaType, QualityValue> getMediaTypeQualityValues(String header) { if (header == null) return null; header = header.trim(); if (header.length() == 0) return null; Map<MediaType, QualityValue> result = new LinkedHashMap<MediaType, QualityValue>(); in...
java
{ "resource": "" }
q155431
BytecodeInjectReactive.addMethod
train
private static int addMethod(ConstPool cPool, CtMethod method) { // addMethodrefInfo is a safe add, if constant already present it return the existing value without adding. return cPool.addMethodrefInfo( cPool.getThisClassInfo(), method.getName(), method.getSignature() ); }
java
{ "resource": "" }
q155432
BytecodeInjectReactive.isCtFieldACollection
train
private boolean isCtFieldACollection(CtField ctField) { try { return ctField.getType().equals(cp.get(Collection.class.getName())) || ctField.getType().equals(cp.get(List.class.getName())) || ctField.getType().equals(cp.get(Set.class.getName())) ; } cat...
java
{ "resource": "" }
q155433
KieServicesFactory.newRestConfiguration
train
public static KieServicesConfiguration newRestConfiguration( String serverUrl, String login, String password, long timeout ) { return new KieServicesConfigurationImpl( serverUrl, login, password, timeout ); }
java
{ "resource": "" }
q155434
MultiDexClassLoader.writeClass
train
private String writeClass(String name, byte[] bytes) throws IOException { name = name.replace('.','/'); File dexFile = new File(String.format("%s/%s.dex", getDexDir(), name)); if(dexFile.exists() && isReuseClassFiles()) { if (log.isTraceEnabled()) log.trace(String.for...
java
{ "resource": "" }
q155435
KieServerImpl.storeServerState
train
private void storeServerState(Consumer<KieServerState> kieServerStateConsumer) { KieServerState currentState = repository.load(KieServerEnvironment.getServerId()); kieServerStateConsumer.accept(currentState); repository.store(KieServerEnvironment.getServerId(), currentState); }
java
{ "resource": "" }
q155436
InjectReactiveMojo.walkDir
train
private void walkDir(File dir) { walkDir( dir, new FileFilter() { @Override public boolean accept(File pathname) { return ( pathname.isFile() && pathname.getName().endsWith( ".class" ) ); } ...
java
{ "resource": "" }
q155437
KieServerStateOpenShiftRepository.isKieContainerUpdateDuringRolloutAllowed
train
public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) { KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY)); for (KieContainerResource container : state.getContainers()) { if (container.getStatus().equals(KieContaine...
java
{ "resource": "" }
q155438
OsgiKieModule.parseBundleId
train
public static String parseBundleId(String url) { if (isOsgiBundleUrl(url)) { int slashesIdx = url.indexOf("://"); return url.substring(slashesIdx + "://".length(), url.indexOf('.')); } else { return null; } }
java
{ "resource": "" }
q155439
OsgiKieModule.isOsgiBundleUrl
train
public static boolean isOsgiBundleUrl(String str) { if (str == null) { throw new NullPointerException("Specified string can not be null!"); } return str.startsWith("bundle") && str.contains("://"); }
java
{ "resource": "" }
q155440
ExecutorServiceBase.convertToRequestInfoList
train
protected RequestInfoInstanceList convertToRequestInfoList(List<RequestInfo> requests, boolean withErrors, boolean withData) { RequestInfoInstance[] requestInfos = new RequestInfoInstance[requests.size()]; int index = 0; for (RequestInfo request : requests) { requestInfos[index] = ...
java
{ "resource": "" }
q155441
KieServerHttpRequest.basicAuthorization
train
public KieServerHttpRequest basicAuthorization(final String name, final String password ) { return header(AUTHORIZATION, "Basic " + org.kie.server.common.rest.Base64Util.encode(name + ':' + password)); }
java
{ "resource": "" }
q155442
KieServerHttpRequest.contentType
train
public KieServerHttpRequest contentType(final String contentType, final String charset ) { if( charset != null && charset.length() > 0 ) { final String separator = "; " + PARAM_CHARSET + '='; return header(CONTENT_TYPE, contentType + separator + charset); } else retur...
java
{ "resource": "" }
q155443
KieServerHttpRequest.accept
train
public KieServerHttpRequest accept(final String accept ) { RequestInfo requestInfo = getRequestInfo(); if( requestInfo.getHeader(ACCEPT).isEmpty() ) { requestInfo.setHeader(ACCEPT, new ArrayList<String>()); } requestInfo.headers.get(ACCEPT).set(0, accept); return this;...
java
{ "resource": "" }
q155444
KieServerHttpRequest.openOutput
train
private KieServerHttpRequest openOutput() throws IOException { if( output != null ) { return this; } getConnection().setDoOutput(true); final String charset = getHeaderParam(getConnection().getRequestProperty(CONTENT_TYPE), PARAM_CHARSET); output = new RequestOutputSt...
java
{ "resource": "" }
q155445
KieServerHttpRequest.closeOutput
train
private KieServerHttpRequest closeOutput() throws IOException { if( connection == null ) { throw new KieServerHttpRequestException("Please execute a HTTP method first on the request."); } if( output == null ) { return this; } if( ignoreCloseExceptions ) { ...
java
{ "resource": "" }
q155446
KieServerHttpRequest.responseHeaders
train
private String[] responseHeaders( final String name ) { final Map<String, List<String>> headers = responseHeaders(); if( headers == null || headers.isEmpty() ) return EMPTY_STRINGS; final List<String> values = headers.get(name); if( values != null && !values.isEmpty() ) ...
java
{ "resource": "" }
q155447
KieServerHttpRequest.responseHeaderParameter
train
private String responseHeaderParameter( final String headerName, final String paramName ) { return getHeaderParam(responseHeader(headerName), paramName); }
java
{ "resource": "" }
q155448
KieServerHttpRequest.getHeaderParams
train
private static Map<String, String> getHeaderParams( final String header ) { if( header == null || header.length() == 0 ) return Collections.emptyMap(); final int headerLength = header.length(); int start = header.indexOf(';') + 1; if( start == 0 || start == headerLength ) ...
java
{ "resource": "" }
q155449
KieServerHttpRequest.getHeaderParam
train
private static String getHeaderParam( final String value, final String paramName ) { if( value == null || value.length() == 0 ) return null; final int length = value.length(); int start = value.indexOf(';') + 1; if( start == 0 || start == length ) return null; ...
java
{ "resource": "" }
q155450
KieServerMDB.startConnectionAndSession
train
private JMSConnection startConnectionAndSession() { JMSConnection result = null; Connection connection = null; Session session = null; try { connection = factory.createConnection(); if ( connection != null ) { session = connection.createSession( sessionTransa...
java
{ "resource": "" }
q155451
SVGImageProcessor.transform
train
public static String transform(InputStream svg, List<String> completed, List<String> active) { return transform(svg, completed, active, null, COMPLETED_COLOR, COMPLETED_BORDER_COLOR, ACTIVE_BORDER_COLOR); }
java
{ "resource": "" }
q155452
UserTaskServicesClientImpl.findTaskByWorkItemId
train
@Override public TaskInstance findTaskByWorkItemId(Long workItemId) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(WORK_ITEM_ID, workItemId); return makeHttpGetRequestAndCreateCustomResponse( bui...
java
{ "resource": "" }
q155453
AbstractKieServicesClientImpl.initializeURI
train
protected String initializeURI(URL url, String servicePrefix) { if ( url == null ) { throw new IllegalArgumentException( "The url may not be empty or null." ); } try { url.toURI(); } catch ( URISyntaxException urise ) { throw new IllegalArgumentExcepti...
java
{ "resource": "" }
q155454
KiePolicy.augmentJaxbDataFormatDefinition
train
public static JaxbDataFormat augmentJaxbDataFormatDefinition(JaxbDataFormat jaxbDataFormat) { Set<String> set = new HashSet<String>(); for (String clsName : DroolsJaxbHelperProviderImpl.JAXB_ANNOTATED_CMD) { set.add(clsName.substring(0, clsName.lastIndexOf('.'))); } StringB...
java
{ "resource": "" }
q155455
FastCloner.registerFastCloners
train
protected void registerFastCloners() { this.fastCloners.put(GregorianCalendar.class, new FastClonerCalendar()); this.fastCloners.put(ArrayList.class, new FastClonerArrayList()); this.fastCloners.put(Arrays.asList(new Object[] {""}).getClass(), new FastClonerArrayList()); this.fastCloners...
java
{ "resource": "" }
q155456
FastCloner.registerKnownJdkImmutableClasses
train
protected void registerKnownJdkImmutableClasses() { registerImmutable(String.class); registerImmutable(Integer.class); registerImmutable(Long.class); registerImmutable(Boolean.class); registerImmutable(Class.class); registerImmutable(Float.class); registerImmutabl...
java
{ "resource": "" }
q155457
FastCloner.registerStaticFields
train
public void registerStaticFields(final Class<?>... classes) { for (final Class<?> c : classes) { final List<Field> fields = allFields(c); for (final Field field : fields) { final int mods = field.getModifiers(); if (Modifier.isStatic(mods) && !field.getTyp...
java
{ "resource": "" }
q155458
FastCloner.deepClone
train
public <T> T deepClone(final T o) { if (o == null) { return null; } if (!this.cloningEnabled) { return o; } if (this.dumpClonedClasses) { System.out.println("start>" + o.getClass()); } final Map<Object, Object> clones = new Iden...
java
{ "resource": "" }
q155459
FastCloner.copyPropertiesOfInheritedClass
train
public <T, E extends T> void copyPropertiesOfInheritedClass(final T src, final E dest) { if (src == null) { throw new IllegalArgumentException("src can't be null"); } if (dest == null) { throw new IllegalArgumentException("dest can't be null"); } final Cla...
java
{ "resource": "" }
q155460
ContainerAliasResolver.forCaseInstance
train
public String forCaseInstance(String alias, String caseId) { return registry.getContainerId(alias, new ByCaseIdContainerLocator(caseId)); }
java
{ "resource": "" }
q155461
ContainerAliasResolver.forProcessInstance
train
public String forProcessInstance(String alias, long processInstanceId) { return registry.getContainerId(alias, new ByProcessInstanceIdContainerLocator(processInstanceId)); }
java
{ "resource": "" }
q155462
ContainerAliasResolver.forTaskInstance
train
public String forTaskInstance(String alias, long taskId) { return registry.getContainerId(alias, new ByTaskIdContainerLocator(taskId)); }
java
{ "resource": "" }
q155463
PackrConfig.validate
train
void validate() throws IOException { validate(platform, "platform"); validate(jdk, "JDK"); validate(executable, "executable name"); validate(mainClass, "main class"); validate(outDir, "output folder"); if (outDir.exists()) { if (new File(".").equals(outDir)) { throw new IOException("Output directory...
java
{ "resource": "" }
q155464
IndirectBigQueryOutputCommitter.commitJob
train
@Override public void commitJob(JobContext context) throws IOException { super.commitJob(context); // Get the destination configuration information. Configuration conf = context.getConfiguration(); TableReference destTable = BigQueryOutputConfiguration.getTableReference(conf); String destProjectI...
java
{ "resource": "" }
q155465
IndirectBigQueryOutputCommitter.abortJob
train
@Override public void abortJob(JobContext context, State state) throws IOException { super.abortJob(context, state); cleanup(context); }
java
{ "resource": "" }
q155466
ForwardingBigQueryFileOutputCommitter.cleanup
train
protected void cleanup(JobContext context) throws IOException { boolean delete = BigQueryOutputConfiguration.getCleanupTemporaryDataFlag(context.getConfiguration()); if (delete && outputFileSystem.exists(outputPath)) { logger.atInfo().log("Found GCS output data at '%s', attempting to clean up.", ...
java
{ "resource": "" }
q155467
GoogleHadoopFSInputStream.read
train
@Override public synchronized int read() throws IOException { long startTime = System.nanoTime(); // TODO(user): Wrap this in a while-loop if we ever introduce a non-blocking mode for the // underlying channel. int numRead = channel.read(ByteBuffer.wrap(singleReadBuf)); if (numRead == -1) { ...
java
{ "resource": "" }
q155468
GoogleHadoopFSInputStream.read
train
@Override public synchronized int read(byte[] buf, int offset, int length) throws IOException { long startTime = System.nanoTime(); Preconditions.checkNotNull(buf, "buf must not be null"); if (offset < 0 || length < 0 || length > buf.length - offset) { throw new IndexOutOfBoundsException(); } ...
java
{ "resource": "" }
q155469
GoogleHadoopFSInputStream.read
train
@Override public synchronized int read(long position, byte[] buf, int offset, int length) throws IOException { long startTime = System.nanoTime(); int result = super.read(position, buf, offset, length); if (result > 0) { // -1 means we actually read 0 bytes, but requested at least one byte. ...
java
{ "resource": "" }
q155470
GoogleHadoopFSInputStream.getPos
train
@Override public synchronized long getPos() throws IOException { long pos = channel.position(); logger.atFine().log("getPos: %d", pos); return pos; }
java
{ "resource": "" }
q155471
GoogleHadoopFSInputStream.seek
train
@Override public synchronized void seek(long pos) throws IOException { long startTime = System.nanoTime(); logger.atFine().log("seek: %d", pos); try { channel.position(pos); } catch (IllegalArgumentException e) { throw new IOException(e); } long duration = System.nanoTime() - start...
java
{ "resource": "" }
q155472
GoogleHadoopFSInputStream.close
train
@Override public synchronized void close() throws IOException { if (channel != null) { long startTime = System.nanoTime(); logger.atFine().log("close: file: %s, totalBytesRead: %d", gcsPath, totalBytesRead); channel.close(); long duration = System.nanoTime() - startTime; ghfs.increme...
java
{ "resource": "" }
q155473
AbstractBigQueryInputFormat.setTemporaryCloudStorageDirectory
train
public static void setTemporaryCloudStorageDirectory(Configuration configuration, String path) { configuration.set(BigQueryConfiguration.TEMP_GCS_PATH_KEY, path); }
java
{ "resource": "" }
q155474
AbstractBigQueryInputFormat.cleanupJob
train
public static void cleanupJob(Configuration configuration, JobID jobId) throws IOException { String exportPathRoot = BigQueryConfiguration.getTemporaryPathRoot(configuration, jobId); configuration.set(BigQueryConfiguration.TEMP_GCS_PATH_KEY, exportPathRoot); Bigquery bigquery = null; try { bigquer...
java
{ "resource": "" }
q155475
PropertyUtil.getPropertyOrDefault
train
public static String getPropertyOrDefault( Class<?> referenceClass, String propertyFile, String key, String defaultValue) { try (InputStream stream = referenceClass.getResourceAsStream(propertyFile)) { if (stream == null) { logger.atSevere().log("Could not load properties file ...
java
{ "resource": "" }
q155476
BigQueryHelper.exportBigQueryToGcs
train
public void exportBigQueryToGcs(String projectId, TableReference tableRef, List<String> gcsPaths, boolean awaitCompletion) throws IOException, InterruptedException { logger.atFine().log( "exportBigQueryToGcs(bigquery, '%s', '%s', '%s', '%s')", projectId, BigQueryStrings.toString(tableRef), gcs...
java
{ "resource": "" }
q155477
BigQueryHelper.tableExists
train
public boolean tableExists(TableReference tableRef) throws IOException { try { Table fetchedTable = service.tables().get( tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()).execute(); logger.atFine().log( "Successfully fetched table '%s' for tableRef '%s'", fetc...
java
{ "resource": "" }
q155478
BigQueryHelper.getTable
train
public Table getTable(TableReference tableRef) throws IOException { Bigquery.Tables.Get getTablesReply = service.tables().get( tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()); return getTablesReply.execute(); }
java
{ "resource": "" }
q155479
GoogleCloudStorageFileSystem.create
train
public WritableByteChannel create(URI path, CreateFileOptions options) throws IOException { logger.atFine().log("create(%s)", path); Preconditions.checkNotNull(path, "path could not be null"); if (FileInfo.isDirectoryPath(path)) { throw new IOException( String.format("Cannot create a file wh...
java
{ "resource": "" }
q155480
GoogleCloudStorageFileSystem.open
train
public SeekableByteChannel open(URI path, GoogleCloudStorageReadOptions readOptions) throws IOException { logger.atFine().log("open(%s, %s)", path, readOptions); Preconditions.checkNotNull(path); checkArgument(!FileInfo.isDirectoryPath(path), "Cannot open a directory for reading: %s", path); // V...
java
{ "resource": "" }
q155481
GoogleCloudStorageFileSystem.delete
train
public void delete(URI path, boolean recursive) throws IOException { Preconditions.checkNotNull(path, "path can not be null"); checkArgument(!path.equals(GCS_ROOT), "Cannot delete root path (%s)", path); logger.atFine().log("delete(%s, %s)", path, recursive); FileInfo fileInfo = getFileInfo(path); ...
java
{ "resource": "" }
q155482
GoogleCloudStorageFileSystem.deleteInternal
train
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before the...
java
{ "resource": "" }
q155483
GoogleCloudStorageFileSystem.exists
train
public boolean exists(URI path) throws IOException { logger.atFine().log("exists(%s)", path); return getFileInfo(path).exists(); }
java
{ "resource": "" }
q155484
GoogleCloudStorageFileSystem.mkdirs
train
public void mkdirs(URI path) throws IOException { logger.atFine().log("mkdirs(%s)", path); Preconditions.checkNotNull(path); if (path.equals(GCS_ROOT)) { // GCS_ROOT directory always exists, no need to go through the rest of the method. return; } StorageResourceId resourceId = pathCode...
java
{ "resource": "" }
q155485
GoogleCloudStorageFileSystem.compose
train
public void compose(List<URI> sources, URI destination, String contentType) throws IOException { StorageResourceId destResource = StorageResourceId.fromObjectName(destination.toString()); List<String> sourceObjects = Lists.transform( sources, uri -> StorageResourceId.fromObjectName(uri.toStr...
java
{ "resource": "" }
q155486
GoogleCloudStorageFileSystem.renameInternal
train
private void renameInternal(FileInfo srcInfo, URI dst) throws IOException { if (srcInfo.isDirectory()) { renameDirectoryInternal(srcInfo, dst); } else { URI src = srcInfo.getPath(); StorageResourceId srcResourceId = pathCodec.validatePathAndGetId(src, true); StorageResourceId dstResource...
java
{ "resource": "" }
q155487
GoogleCloudStorageFileSystem.renameDirectoryInternal
train
private void renameDirectoryInternal(FileInfo srcInfo, URI dst) throws IOException { checkArgument(srcInfo.isDirectory(), "'%s' should be a directory", srcInfo); Pattern markerFilePattern = options.getMarkerFilePattern(); // Mapping from each src to its respective dst. // Sort src items so that parent...
java
{ "resource": "" }
q155488
GoogleCloudStorageFileSystem.copyInternal
train
private void copyInternal(Map<FileInfo, URI> srcToDstItemNames) throws IOException { if (srcToDstItemNames.isEmpty()) { return; } String srcBucketName = null; String dstBucketName = null; List<String> srcObjectNames = new ArrayList<>(srcToDstItemNames.size()); List<String> dstObjectNames ...
java
{ "resource": "" }
q155489
GoogleCloudStorageFileSystem.listFileNames
train
public List<URI> listFileNames(FileInfo fileInfo, boolean recursive) throws IOException { Preconditions.checkNotNull(fileInfo); URI path = fileInfo.getPath(); logger.atFine().log("listFileNames(%s)", path); List<URI> paths = new ArrayList<>(); List<String> childNames; // If it is a direc...
java
{ "resource": "" }
q155490
GoogleCloudStorageFileSystem.listFileInfo
train
public List<FileInfo> listFileInfo(URI path) throws IOException { Preconditions.checkNotNull(path, "path can not be null"); logger.atFine().log("listFileInfo(%s)", path); StorageResourceId pathId = pathCodec.validatePathAndGetId(path, true); StorageResourceId dirId = pathCodec.validatePathAndGe...
java
{ "resource": "" }
q155491
GoogleCloudStorageFileSystem.getFileInfo
train
public FileInfo getFileInfo(URI path) throws IOException { logger.atFine().log("getFileInfo(%s)", path); checkArgument(path != null, "path must not be null"); // Validate the given path. true == allow empty object name. // One should be able to get info about top level directory (== bucket), // ther...
java
{ "resource": "" }
q155492
GoogleCloudStorageFileSystem.close
train
public void close() { if (gcs != null) { logger.atFine().log("close()"); try { gcs.close(); } finally { gcs = null; if (updateTimestampsExecutor != null) { try { shutdownExecutor(updateTimestampsExecutor, /* waitSeconds= */ 10); } finally { ...
java
{ "resource": "" }
q155493
GoogleCloudStorageFileSystem.mkdir
train
@VisibleForTesting public void mkdir(URI path) throws IOException { logger.atFine().log("mkdir(%s)", path); Preconditions.checkNotNull(path); checkArgument(!path.equals(GCS_ROOT), "Cannot create root directory."); StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true); ...
java
{ "resource": "" }
q155494
GoogleCloudStorageFileSystem.validateBucketName
train
static String validateBucketName(String bucketName) { // If the name ends with /, remove it. bucketName = FileInfo.convertToFilePath(bucketName); if (Strings.isNullOrEmpty(bucketName)) { throw new IllegalArgumentException( "Google Cloud Storage bucket name cannot be empty."); } if...
java
{ "resource": "" }
q155495
GoogleCloudStorageFileSystem.validateObjectName
train
static String validateObjectName(String objectName, boolean allowEmptyObjectName) { logger.atFine().log("validateObjectName('%s', %s)", objectName, allowEmptyObjectName); if (isNullOrEmpty(objectName) || objectName.equals(PATH_DELIMITER)) { if (allowEmptyObjectName) { objectName = ""; } els...
java
{ "resource": "" }
q155496
GoogleCloudStorageFileSystem.getItemName
train
String getItemName(URI path) { Preconditions.checkNotNull(path); // There is no leaf item for the root path. if (path.equals(GCS_ROOT)) { return null; } StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true); if (resourceId.isBucket()) { return resourceId.getBuc...
java
{ "resource": "" }
q155497
GoogleCloudStorageFileSystem.validatePathAndGetId
train
@Deprecated public static StorageResourceId validatePathAndGetId(URI uri, boolean allowEmptyObjectNames) { return LEGACY_PATH_CODEC.validatePathAndGetId(uri, allowEmptyObjectNames); }
java
{ "resource": "" }
q155498
GoogleCloudStorageFileSystem.getParentPath
train
@Deprecated public static URI getParentPath(PathCodec pathCodec, URI path) { Preconditions.checkNotNull(path); // Root path has no parent. if (path.equals(GCS_ROOT)) { return null; } StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true); if (resourceId.isBucket()) ...
java
{ "resource": "" }
q155499
FederatedBigQueryOutputCommitter.commitJob
train
@Override public void commitJob(JobContext context) throws IOException { super.commitJob(context); // Get the destination configuration information. Configuration conf = context.getConfiguration(); TableReference destTable = BigQueryOutputConfiguration.getTableReference(conf); String destProjectI...
java
{ "resource": "" }