_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q30300
Cors.toBuilder
train
public Builder toBuilder() { return newBuilder() .setMaxAgeSeconds(maxAgeSeconds) .setMethods(methods) .setOrigins(origins) .setResponseHeaders(responseHeaders); }
java
{ "resource": "" }
q30301
BackendBucketClient.deleteSignedUrlKeyBackendBucket
train
@BetaApi public final Operation deleteSignedUrlKeyBackendBucket( ProjectGlobalBackendBucketName backendBucket, String keyName) { DeleteSignedUrlKeyBackendBucketHttpRequest request = DeleteSignedUrlKeyBackendBucketHttpRequest.newBuilder() .setBackendBucket(backendBucket == null ? null : ...
java
{ "resource": "" }
q30302
BackendBucketClient.updateBackendBucket
train
@BetaApi public final Operation updateBackendBucket( String backendBucket, BackendBucket backendBucketResource, List<String> fieldMask) { UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest.newBuilder() .setBackendBucket(backendBucket) .setBackendBucketRe...
java
{ "resource": "" }
q30303
Table.list
train
public TableResult list(Schema schema, TableDataListOption... options) throws BigQueryException { return bigquery.listTableData(getTableId(), schema, options); }
java
{ "resource": "" }
q30304
Role.of
train
public static Role of(String value) { checkNotNull(value); if (!value.contains("/")) { value = ROLE_PREFIX + value; } return new Role(value); }
java
{ "resource": "" }
q30305
CloudRedisClient.createInstanceAsync
train
@BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Instance, OperationMetadata> createInstanceAsync( LocationName parent, String instanceId, Instance instance) { CreateInstanceRequest request = CreateInstanceReques...
java
{ "resource": "" }
q30306
ZoneOperationId.of
train
public static ZoneOperationId of(ZoneId zoneId, String operation) { return new ZoneOperationId(zoneId.getProject(), zoneId.getZone(), operation); }
java
{ "resource": "" }
q30307
ZoneOperationId.of
train
public static ZoneOperationId of(String zone, String operation) { return new ZoneOperationId(null, zone, operation); }
java
{ "resource": "" }
q30308
ZoneOperationId.of
train
public static ZoneOperationId of(String project, String zone, String operation) { return new ZoneOperationId(project, zone, operation); }
java
{ "resource": "" }
q30309
DeviceManagerClient.updateDeviceRegistry
train
public final DeviceRegistry updateDeviceRegistry( DeviceRegistry deviceRegistry, FieldMask updateMask) { UpdateDeviceRegistryRequest request = UpdateDeviceRegistryRequest.newBuilder() .setDeviceRegistry(deviceRegistry) .setUpdateMask(updateMask) .build(); retur...
java
{ "resource": "" }
q30310
DeviceManagerClient.updateDevice
train
public final Device updateDevice(Device device, FieldMask updateMask) { UpdateDeviceRequest request = UpdateDeviceRequest.newBuilder().setDevice(device).setUpdateMask(updateMask).build(); return updateDevice(request); }
java
{ "resource": "" }
q30311
DeviceManagerClient.bindDeviceToGateway
train
public final BindDeviceToGatewayResponse bindDeviceToGateway( String parent, String gatewayId, String deviceId) { BindDeviceToGatewayRequest request = BindDeviceToGatewayRequest.newBuilder() .setParent(parent) .setGatewayId(gatewayId) .setDeviceId(deviceId) ...
java
{ "resource": "" }
q30312
DeviceManagerClient.unbindDeviceFromGateway
train
public final UnbindDeviceFromGatewayResponse unbindDeviceFromGateway( RegistryName parent, String gatewayId, String deviceId) { UnbindDeviceFromGatewayRequest request = UnbindDeviceFromGatewayRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setGatewa...
java
{ "resource": "" }
q30313
SessionPool.releaseSession
train
private void releaseSession(PooledSession session) { Preconditions.checkNotNull(session); synchronized (lock) { if (closureFuture != null) { return; } if (readWaiters.size() == 0 && numSessionsBeingPrepared >= readWriteWaiters.size()) { // No pending waiters if (shouldP...
java
{ "resource": "" }
q30314
UptimeCheckServiceClient.listUptimeCheckConfigs
train
public final ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(String parent) { ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder().setParent(parent).build(); return listUptimeCheckConfigs(request); }
java
{ "resource": "" }
q30315
UptimeCheckServiceClient.createUptimeCheckConfig
train
public final UptimeCheckConfig createUptimeCheckConfig( String parent, UptimeCheckConfig uptimeCheckConfig) { CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder() .setParent(parent) .setUptimeCheckConfig(uptimeCheckConfig) .build(); ...
java
{ "resource": "" }
q30316
UptimeCheckServiceClient.updateUptimeCheckConfig
train
public final UptimeCheckConfig updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig) { UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder().setUptimeCheckConfig(uptimeCheckConfig).build(); return updateUptimeCheckConfig(request); }
java
{ "resource": "" }
q30317
TopicAdminClientSnippets.listTopics
train
public ListTopicsPagedResponse listTopics() throws Exception { // [START pubsub_list_topics] try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { ListTopicsRequest listTopicsRequest = ListTopicsRequest.newBuilder().setProject(ProjectName.format(projectId)).build(); ListTop...
java
{ "resource": "" }
q30318
TopicAdminClientSnippets.listTopicSubscriptions
train
public ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String topicId) throws Exception { // [START pubsub_list_topic_subscriptions] try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); ListTopicS...
java
{ "resource": "" }
q30319
TopicAdminClientSnippets.deleteTopic
train
public ProjectTopicName deleteTopic(String topicId) throws Exception { // [START pubsub_delete_topic] try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); topicAdminClient.deleteTopic(topicName); return topi...
java
{ "resource": "" }
q30320
TopicAdminClientSnippets.getTopicPolicy
train
public Policy getTopicPolicy(String topicId) throws Exception { // [START pubsub_get_topic_policy] try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); Policy policy = topicAdminClient.getIamPolicy(topicName.toStr...
java
{ "resource": "" }
q30321
TopicAdminClientSnippets.replaceTopicPolicy
train
public Policy replaceTopicPolicy(String topicId) throws Exception { // [START pubsub_set_topic_policy] try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { String topicName = ProjectTopicName.format(projectId, topicId); Policy policy = topicAdminClient.getIamPolicy(topicName); ...
java
{ "resource": "" }
q30322
TopicAdminClientSnippets.getTopic
train
public Topic getTopic(String topicId) throws Exception { // [START pubsub_get_topic] try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); Topic topic = topicAdminClient.getTopic(topicName); return topic; ...
java
{ "resource": "" }
q30323
HttpsHealthCheckClient.updateHttpsHealthCheck
train
@BetaApi public final Operation updateHttpsHealthCheck( ProjectGlobalHttpsHealthCheckName httpsHealthCheck, HttpsHealthCheck2 httpsHealthCheckResource, List<String> fieldMask) { UpdateHttpsHealthCheckHttpRequest request = UpdateHttpsHealthCheckHttpRequest.newBuilder() .setHt...
java
{ "resource": "" }
q30324
HttpStorageRpc.startSpan
train
private Span startSpan(String spanName) { return tracer .spanBuilder(spanName) .setRecordEvents(censusHttpModule.isRecordEvents()) .startSpan(); }
java
{ "resource": "" }
q30325
TemplateServlet.createAndStoreTemplate
train
private Template createAndStoreTemplate(String key, InputStream inputStream, File file) throws Exception { if (verbose) { log("Creating new template from " + key + "..."); } Reader reader = null; try { String fileEncoding = (fileEncodingParamVal != null) ? fileE...
java
{ "resource": "" }
q30326
ParameterUtils.parametersCompatible
train
public static boolean parametersCompatible(Parameter[] source, Parameter[] target) { return parametersMatch(source, target, t -> ClassHelper.getWrapper(t.getV2()).getTypeClass() .isAssignableFrom(ClassHelper.getWrapper(t.getV1()).getTypeClass()) ); }
java
{ "resource": "" }
q30327
StaticImportVisitor.setSourcePosition
train
private static void setSourcePosition(Expression toSet, Expression origNode) { toSet.setSourcePosition(origNode); if (toSet instanceof PropertyExpression) { ((PropertyExpression) toSet).getProperty().setSourcePosition(origNode); } }
java
{ "resource": "" }
q30328
XmlSlurper.parse
train
public GPathResult parse(final InputSource input) throws IOException, SAXException { reader.setContentHandler(this); reader.parse(input); return getDocument(); }
java
{ "resource": "" }
q30329
XmlSlurper.parse
train
public GPathResult parse(final File file) throws IOException, SAXException { final FileInputStream fis = new FileInputStream(file); final InputSource input = new InputSource(fis); input.setSystemId("file://" + file.getAbsolutePath()); try { return parse(input); } fina...
java
{ "resource": "" }
q30330
XmlSlurper.setEntityBaseUrl
train
public void setEntityBaseUrl(final URL base) { reader.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(final String publicId, final String systemId) throws IOException { return new InputSource(new URL(base, systemId).openStream()); } }); ...
java
{ "resource": "" }
q30331
AbstractInterruptibleASTTransformation.wrapBlock
train
protected final Statement wrapBlock(Statement statement) { BlockStatement stmt = new BlockStatement(); stmt.addStatement(createInterruptStatement()); stmt.addStatement(statement); return stmt; }
java
{ "resource": "" }
q30332
AbstractInterruptibleASTTransformation.visitLoop
train
private void visitLoop(LoopingStatement loopStatement) { Statement statement = loopStatement.getLoopBlock(); loopStatement.setLoopBlock(wrapBlock(statement)); }
java
{ "resource": "" }
q30333
MetaClassRegistryImpl.installMetaClassCreationHandle
train
private void installMetaClassCreationHandle() { try { final Class customMetaClassHandle = Class.forName("groovy.runtime.metaclass.CustomMetaClassCreationHandle"); final Constructor customMetaClassHandleConstructor = customMetaClassHandle.getConstructor(); this.m...
java
{ "resource": "" }
q30334
MetaClassRegistryImpl.setMetaClass
train
private void setMetaClass(Class theClass, MetaClass oldMc, MetaClass newMc) { final ClassInfo info = ClassInfo.getClassInfo(theClass); MetaClass mc = null; info.lock(); try { mc = info.getStrongMetaClass(); info.setStrongMetaClass(newMc); } finall...
java
{ "resource": "" }
q30335
MetaClassRegistryImpl.fireConstantMetaClassUpdate
train
protected void fireConstantMetaClassUpdate(Object obj, Class c, final MetaClass oldMC, MetaClass newMc) { MetaClassRegistryChangeEventListener[] listener = getMetaClassRegistryChangeEventListeners(); MetaClassRegistryChangeEvent cmcu = new MetaClassRegistryChangeEvent(this, obj, c, oldMC, newMc); ...
java
{ "resource": "" }
q30336
MetaClassRegistryImpl.iterator
train
public Iterator iterator() { final MetaClass[] refs = metaClassInfo.toArray(EMPTY_METACLASS_ARRAY); return new Iterator() { // index in the ref array private int index = 0; // the current meta class private MetaClass currentMeta; // us...
java
{ "resource": "" }
q30337
FactoryBuilderSupport.checkValueIsType
train
public static boolean checkValueIsType(Object value, Object name, Class type) { if (value != null) { if (type.isAssignableFrom(value.getClass())) { return true; } else { throw new RuntimeException("The value argument of '" + name + "' must be of type " ...
java
{ "resource": "" }
q30338
FactoryBuilderSupport.autoRegisterNodes
train
public void autoRegisterNodes() { // if java did atomic blocks, this would be one synchronized (this) { if (autoRegistrationRunning || autoRegistrationComplete) { // registration already done or in process, abort return; } } autoReg...
java
{ "resource": "" }
q30339
FactoryBuilderSupport.registerFactory
train
public void registerFactory(String name, String groupName, Factory factory) { getProxyBuilder().factories.put(name, factory); getRegistrationGroup(groupName).add(name); factory.onFactoryRegistration(this, name, groupName); }
java
{ "resource": "" }
q30340
FactoryBuilderSupport.createNode
train
protected Object createNode(Object name, Map attributes, Object value) { Object node; Factory factory = getProxyBuilder().resolveFactory(name, attributes, value); if (factory == null) { LOG.log(Level.WARNING, "Could not find match for name '" + name + "'"); throw new Mis...
java
{ "resource": "" }
q30341
FactoryBuilderSupport.resolveFactory
train
protected Factory resolveFactory(Object name, Map attributes, Object value) { getProxyBuilder().getContext().put(CHILD_BUILDER, getProxyBuilder()); return getProxyBuilder().getFactories().get(name); }
java
{ "resource": "" }
q30342
FactoryBuilderSupport.resolveExplicitMethod
train
@SuppressWarnings({"UnusedDeclaration"}) protected Closure resolveExplicitMethod(String methodName, Object args) { return getExplicitMethods().get(methodName); }
java
{ "resource": "" }
q30343
FactoryBuilderSupport.doInvokeMethod
train
private Object doInvokeMethod(String methodName, Object name, Object args) { Reference explicitResult = new Reference(); if (checkExplicitMethod(methodName, args, explicitResult)) { return explicitResult.get(); } else { try { return dispatchNodeCall(name, ...
java
{ "resource": "" }
q30344
FactoryBuilderSupport.getName
train
public Object getName(String methodName) { if (getProxyBuilder().nameMappingClosure != null) { return getProxyBuilder().nameMappingClosure.call(methodName); } return methodName; }
java
{ "resource": "" }
q30345
FactoryBuilderSupport.getProxyBuilder
train
protected FactoryBuilderSupport getProxyBuilder() { FactoryBuilderSupport proxy = localProxyBuilder.get(); if (proxy == null) { return globalProxyBuilder; } else { return proxy; } }
java
{ "resource": "" }
q30346
FactoryBuilderSupport.nodeCompleted
train
protected void nodeCompleted(Object parent, Object node) { getProxyBuilder().getCurrentFactory().onNodeCompleted(getProxyBuilder().getChildBuilder(), parent, node); }
java
{ "resource": "" }
q30347
FactoryBuilderSupport.popContext
train
protected Map<String, Object> popContext() { if (!getProxyBuilder().getContexts().isEmpty()) { return getProxyBuilder().getContexts().removeFirst(); } return null; }
java
{ "resource": "" }
q30348
FactoryBuilderSupport.getContinuationData
train
protected Map<String, Object> getContinuationData() { Map<String, Object> data = new HashMap<String, Object>(); data.put("proxyBuilder", localProxyBuilder.get()); data.put("contexts", contexts.get()); return data; }
java
{ "resource": "" }
q30349
FactoryBuilderSupport.restoreFromContinuationData
train
protected void restoreFromContinuationData(Map<String, Object> data) { //noinspection unchecked localProxyBuilder.set((FactoryBuilderSupport) data.get("proxyBuilder")); //noinspection unchecked contexts.set((LinkedList<Map<String, Object>>) data.get("contexts")); }
java
{ "resource": "" }
q30350
Utilities.repeatString
train
public static String repeatString( String pattern, int repeats ) { StringBuilder buffer = new StringBuilder( pattern.length() * repeats ); for( int i = 0; i < repeats; i++ ) { buffer.append( pattern ); } return new String( buffer ); }
java
{ "resource": "" }
q30351
Utilities.isJavaIdentifier
train
public static boolean isJavaIdentifier(String name) { if (name.length() == 0 || INVALID_JAVA_IDENTIFIERS.contains(name)) return false; char[] chars = name.toCharArray(); if (!Character.isJavaIdentifierStart(chars[0])) return false; for (int i = 1; i < chars.length; i++ ) { if...
java
{ "resource": "" }
q30352
TableSorter.shuttlesort
train
public void shuttlesort(int from[], int to[], int low, int high) { if (high - low < 2) { return; } int middle = (low + high) / 2; shuttlesort(to, from, low, middle); shuttlesort(to, from, middle, high); int p = low; int q = middle; /* This is...
java
{ "resource": "" }
q30353
TableSorter.addMouseListenerToHeaderInTable
train
public void addMouseListenerToHeaderInTable(JTable table) { final TableSorter sorter = this; final JTable tableView = table; tableView.setColumnSelectionAllowed(false); MouseAdapter listMouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { ...
java
{ "resource": "" }
q30354
ExceptionMessage.write
train
public void write(PrintWriter output, Janitor janitor) { String description = "General error during " + owner.getPhaseDescription() + ": "; String message = cause.getMessage(); if (message != null) { output.println(description + message); } else { output.println(...
java
{ "resource": "" }
q30355
Node.appendNode
train
public Node appendNode(Object name, Map attributes, Object value) { return new Node(this, name, attributes, value); }
java
{ "resource": "" }
q30356
Node.replaceNode
train
public Node replaceNode(Closure c) { if (parent() == null) { throw new UnsupportedOperationException("Replacing the root node is not supported"); } appendNodes(c); getParentList(parent()).remove(this); this.setParent(null); return this; }
java
{ "resource": "" }
q30357
Node.replaceNode
train
public Node replaceNode(Node n) { if (parent() == null) { throw new UnsupportedOperationException("Replacing the root node is not supported"); } List tail = getTail(); parent().appendNode(n.name(), n.attributes(), n.value()); parent().children().addAll(tail); ...
java
{ "resource": "" }
q30358
Node.text
train
public String text() { if (value instanceof String) { return (String) value; } if (value instanceof NodeList) { return ((NodeList) value).text(); } if (value instanceof Collection) { Collection coll = (Collection) value; String prev...
java
{ "resource": "" }
q30359
Node.attribute
train
public Object attribute(Object key) { return (attributes != null) ? attributes.get(key) : null; }
java
{ "resource": "" }
q30360
Node.get
train
public Object get(String key) { if (key != null && key.charAt(0) == '@') { String attributeName = key.substring(1); return attributes().get(attributeName); } if ("..".equals(key)) { return parent(); } if ("*".equals(key)) { return c...
java
{ "resource": "" }
q30361
Node.getByName
train
private NodeList getByName(String name) { NodeList answer = new NodeList(); for (Object child : children()) { if (child instanceof Node) { Node childNode = (Node) child; Object childNodeName = childNode.name(); if (childNodeName instanceof QNam...
java
{ "resource": "" }
q30362
Node.depthFirst
train
public List depthFirst(boolean preorder) { List answer = new NodeList(); if (preorder) answer.add(this); answer.addAll(depthFirstRest(preorder)); if (!preorder) answer.add(this); return answer; }
java
{ "resource": "" }
q30363
Node.depthFirst
train
public void depthFirst(Closure c) { Map<String, Object> options = new ListHashMap<String, Object>(); options.put("preorder", true); depthFirst(options, c); }
java
{ "resource": "" }
q30364
Node.depthFirst
train
public void depthFirst(Map<String, Object> options, Closure c) { boolean preorder = Boolean.valueOf(options.get("preorder").toString()); if (preorder) callClosureForNode(c, this, 1); depthFirstRest(preorder, 2, c); if (!preorder) callClosureForNode(c, this, 1); }
java
{ "resource": "" }
q30365
Node.breadthFirst
train
public void breadthFirst(Map<String, Object> options, Closure c) { boolean preorder = Boolean.valueOf(options.get("preorder").toString()); if (preorder) callClosureForNode(c, this, 1); breadthFirstRest(preorder, 2, c); if (!preorder) callClosureForNode(c, this, 1); }
java
{ "resource": "" }
q30366
GPathResult.setMetaClass
train
@Override public void setMetaClass(final MetaClass metaClass) { final MetaClass newMetaClass = new DelegatingMetaClass(metaClass) { @Override public Object getAttribute(final Object object, final String attribute) { return GPathResult.this.getProperty("@" + attribute)...
java
{ "resource": "" }
q30367
GPathResult.setProperty
train
public void setProperty(final String property, final Object newValue) { if (property.startsWith("@")) { if (newValue instanceof String || newValue instanceof GString) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild chi...
java
{ "resource": "" }
q30368
GPathResult.plus
train
public Object plus(final Object newValue) { this.replaceNode(new Closure(this) { public void doCall(Object[] args) { final GroovyObject delegate = (GroovyObject) getDelegate(); delegate.getProperty("mkp"); delegate.invokeMethod("yield", args); ...
java
{ "resource": "" }
q30369
GPathResult.putAt
train
public void putAt(final int index, final Object newValue) { final GPathResult result = (GPathResult)getAt(index); if (newValue instanceof Closure) { result.replaceNode((Closure)newValue); } else { result.replaceBody(newValue); } }
java
{ "resource": "" }
q30370
GPathResult.depthFirst
train
public Iterator depthFirst() { return new Iterator() { private final List list = new LinkedList(); private final Stack stack = new Stack(); private Iterator iter = iterator(); private GPathResult next = getNextByDepth(); public boolean hasNext() { ...
java
{ "resource": "" }
q30371
GPathResult.breadthFirst
train
public Iterator breadthFirst() { return new Iterator() { private final List list = new LinkedList(); private Iterator iter = iterator(); private GPathResult next = getNextByBreadth(); public boolean hasNext() { return this.next != null; ...
java
{ "resource": "" }
q30372
GPathResult.list
train
public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
java
{ "resource": "" }
q30373
GPathResult.getBody
train
public Closure getBody() { return new Closure(this.parent,this) { public void doCall(Object[] args) { final GroovyObject delegate = (GroovyObject)getDelegate(); final GPathResult thisObject = (GPathResult)getThisObject(); Node node = (Node)thisObject....
java
{ "resource": "" }
q30374
ArrayTypeUtils.dimension
train
public static int dimension(Class clazz) { checkArrayType(clazz); int result = 0; while (clazz.isArray()) { result++; clazz = clazz.getComponentType(); } return result; }
java
{ "resource": "" }
q30375
ArrayTypeUtils.elementType
train
public static Class elementType(Class clazz) { checkArrayType(clazz); while (clazz.isArray()) { clazz = clazz.getComponentType(); } return clazz; }
java
{ "resource": "" }
q30376
ArrayTypeUtils.elementType
train
public static Class elementType(Class clazz, int dim) { checkArrayType(clazz); if (dim < 0) { throw new IllegalArgumentException("The target dimension should not be less than zero: " + dim); } while (clazz.isArray() && dimension(clazz) > dim) { clazz = clazz.get...
java
{ "resource": "" }
q30377
ArrayTypeUtils.checkArrayType
train
private static void checkArrayType(Class clazz) { if (null == clazz) { throw new IllegalArgumentException("clazz can not be null"); } if (!clazz.isArray()) { throw new IllegalArgumentException(clazz.getCanonicalName() + " is not array type"); } }
java
{ "resource": "" }
q30378
ProcessGroovyMethods.getText
train
public static String getText(Process self) throws IOException { String text = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(self.getInputStream()))); closeStreams(self); return text; }
java
{ "resource": "" }
q30379
ProcessGroovyMethods.leftShift
train
public static OutputStream leftShift(Process self, byte[] value) throws IOException { return IOGroovyMethods.leftShift(self.getOutputStream(), value); }
java
{ "resource": "" }
q30380
ProcessGroovyMethods.waitForOrKill
train
public static void waitForOrKill(Process self, long numberOfMillis) { ProcessRunner runnable = new ProcessRunner(self); Thread thread = new Thread(runnable); thread.start(); runnable.waitForOrKill(numberOfMillis); }
java
{ "resource": "" }
q30381
ProcessGroovyMethods.consumeProcessErrorStream
train
public static Thread consumeProcessErrorStream(Process self, OutputStream err) { Thread thread = new Thread(new ByteDumper(self.getErrorStream(), err)); thread.start(); return thread; }
java
{ "resource": "" }
q30382
ProcessGroovyMethods.consumeProcessErrorStream
train
public static Thread consumeProcessErrorStream(Process self, Appendable error) { Thread thread = new Thread(new TextDumper(self.getErrorStream(), error)); thread.start(); return thread; }
java
{ "resource": "" }
q30383
ProcessGroovyMethods.consumeProcessOutputStream
train
public static Thread consumeProcessOutputStream(Process self, Appendable output) { Thread thread = new Thread(new TextDumper(self.getInputStream(), output)); thread.start(); return thread; }
java
{ "resource": "" }
q30384
ProcessGroovyMethods.consumeProcessOutputStream
train
public static Thread consumeProcessOutputStream(Process self, OutputStream output) { Thread thread = new Thread(new ByteDumper(self.getInputStream(), output)); thread.start(); return thread; }
java
{ "resource": "" }
q30385
ProcessGroovyMethods.withWriter
train
public static void withWriter(final Process self, final Closure closure) { new Thread(new Runnable() { public void run() { try { IOGroovyMethods.withWriter(new BufferedOutputStream(getOut(self)), closure); } catch (IOException e) { ...
java
{ "resource": "" }
q30386
ProcessGroovyMethods.pipeTo
train
public static Process pipeTo(final Process left, final Process right) throws IOException { new Thread(new Runnable() { public void run() { InputStream in = new BufferedInputStream(getIn(left)); OutputStream out = new BufferedOutputStream(getOut(right)); ...
java
{ "resource": "" }
q30387
ProcessGroovyMethods.or
train
public static Process or(final Process left, final Process right) throws IOException { return pipeTo(left, right); }
java
{ "resource": "" }
q30388
MethodInvocationTrap.visitMethodCallExpression
train
public void visitMethodCallExpression(MethodCallExpression call) { boolean shouldContinueWalking = true; if (isBuildInvocation(call)) { shouldContinueWalking = handleTargetMethodCallExpression(call); } if (shouldContinueWalking) { // continue normal tree walking...
java
{ "resource": "" }
q30389
GroovyResultSetProxy.invoke
train
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); if (method.getDeclaringClass() == GroovyObject.class) { if (name.equals("getMetaClass")) { return getMetaClass(); } else if (name.equals("setMetaCla...
java
{ "resource": "" }
q30390
DOMBuilder.parse
train
public static Document parse(Reader reader) throws SAXException, IOException, ParserConfigurationException { return parse(reader, false, true); }
java
{ "resource": "" }
q30391
DOMBuilder.parse
train
public static Document parse(Reader reader, boolean validating, boolean namespaceAware) throws SAXException, IOException, ParserConfigurationException { return parse(reader, validating, namespaceAware, false); }
java
{ "resource": "" }
q30392
DOMBuilder.parse
train
public static Document parse(Reader reader, boolean validating, boolean namespaceAware, boolean allowDocTypeDeclaration) throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory factory = FactorySupport.createDocumentBuilderFactory(); factory.setNamespaceAware(...
java
{ "resource": "" }
q30393
DOMBuilder.parseText
train
public Document parseText(String text) throws SAXException, IOException, ParserConfigurationException { return parse(new StringReader(text)); }
java
{ "resource": "" }
q30394
AstBuilder.visit
train
@Override public Object visit(ParseTree tree) { if (!asBoolean(tree)) { return null; } return super.visit(tree); }
java
{ "resource": "" }
q30395
AstBuilder.configureScriptClassNode
train
private void configureScriptClassNode() { ClassNode scriptClassNode = moduleNode.getScriptClassDummy(); if (!asBoolean(scriptClassNode)) { return; } List<Statement> statements = moduleNode.getStatementBlock().getStatements(); if (!statements.isEmpty()) { ...
java
{ "resource": "" }
q30396
Selector.getSelector
train
public static Selector getSelector(MutableCallSite callSite, Class sender, String methodName, int callID, boolean safeNavigation, boolean thisCall, boolean spreadCall, Object[] arguments) { CALL_TYPES callType = CALL_TYPES_VALUES[callID]; switch (callType) { case INIT: return new InitSelecto...
java
{ "resource": "" }
q30397
Selector.getMetaClassImpl
train
private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) { Class mcc = mc.getClass(); boolean valid = mcc == MetaClassImpl.class || mcc == AdaptingMetaClass.class || mcc == ClosureMetaClass.class || (includ...
java
{ "resource": "" }
q30398
Selector.removeRealReceiver
train
private static Object[] removeRealReceiver(Object[] args) { Object[] ar = new Object[args.length-1]; System.arraycopy(args, 1, ar, 0, args.length - 1); return ar; }
java
{ "resource": "" }
q30399
JsonSlurperClassic.parseArray
train
private List parseArray(JsonLexer lexer) { List content = new ArrayList(); JsonToken currentToken; for(;;) { currentToken = lexer.nextToken(); if (currentToken == null) { throw new JsonException( "Expected a value on line: " + le...
java
{ "resource": "" }