code stringlengths 146 466k | prompt stringlengths 54 1.5k |
|---|---|
Of course, here is the Java code you requested:
```java
public void setProjectName(String projectName) {
if (artifactIdCombo.getText().equals(groupIdCombo.getText())) {
groupIdCombo.setText(projectName);
}
artifactIdCombo.setText(projectName);
packageCombo.setText("org." + projectName.replace('-', '.')); //... | Create a Java method that does the following: "Sets the project name.". |
Of course, here is the Java code you requested:
```java
public void setParentProject(String groupId, String artifactId, String version) {
groupIdCombo.setText(groupId);
versionCombo.setText(version);
validate();
}
```
Hope this helps! | Create a Java method that does the following: "Sets the parent project.". |
Of course, here is the Java code you requested:
```java
protected String getDefaultJavaPackage() {
return ProjectWizardParametersPage.getDefaultJavaPackage(groupIdCombo.getText().trim(), artifactIdCombo.getText().trim());
}
```
Hope this helps! | Create a Java method that does the following: "This method returns the default Java package for the wizard.". |
Of course, here is the Java code you requested:
```java
public void setVisible(boolean visible) {
super.setVisible(visible);
boolean shouldValidate = false;
if (visible) {
if (groupIdCombo.getText().length() == 0 && groupIdCombo.getItemCount() > 0) {
groupIdCombo.setText(groupIdCombo.getItem(0));
... | Create a Java method that does the following: "Sets the visibility of the managed object.". |
Of course, here is the Java code you requested:
```java
public void addOrder(Criteria criteria, Order order) {
this.orderList.add(new MetaEntry<Order>(criteria, order));
}
```
Hope this helps! | Create a Java method that does the following: "Add an order to the order list.". |
Of course, here is the Java code you requested:
```java
public void commence(HttpServletRequest req, HttpServletResponse resp, AuthenticationException authException) throws IOException, ServletException {
String redirectUrl = null;
logger.debug("No auth context found. Kicking off a new auth flow.");
Authorizat... | Create a Java method that does the following: "This method is called when the user enters a 401 status code.". |
Of course, here is the Java code you requested:
```java
private List<Object> getQueryParametersAsList() {
// iterate over all restrictions of this criteria
Iterator<MetaEntry<Criterion>> iter = rootCriteria.getCriterionList().iterator();
// result list
List<Object> result = new ArrayList<Object>(... | Create a Java method that does the following: "Get the query parameters as list.". |
Of course, here is the Java code you requested:
```java
public void initializeDefaultPreferences() {
IPreferenceStore store = GlassmakerUIPlugin.getDefault().getPreferenceStore();
store.setDefault(PreferenceConstants.CLIENT_ID,"YOU_MUST_PROVIDE_A_CLIENT_ID");
store.setDefault(PreferenceConstants.CLIENT_SECRET... | Create a Java method that does the following: "Initialize the preferences.". |
Of course, here is the Java code you requested:
```java
public static int compare(String str1, String str2) {
//有一个为null的话按照非null的大处理
if (str1 == null || str2 == null) {
return Integer.compare((str1 == null) ? 0 : 1, (str2 == null) ? 0 : 1);
}
if (str1.length() == 0 || str2... | Create a Java method that does the following: "Compare two strings.". |
Of course, here is the Java code you requested:
```java
public static boolean containGreaterThan(String srcString,
String desString, int number) {
boolean res = false;
int totalNumber = containStatistics(srcString, desString);
if (totalNumber > numbe... | Create a Java method that does the following: "Check if the two strings contain statistics greater than the number of times". |
Of course, here is the Java code you requested:
```java
public static int containStatistics(String srcString, String desString) {
int length = desString.length();
String newString = srcString.replace(desString, "");
return (srcString.length() - newString.length()) / length;
}
```
Hope this... | Create a Java method that does the following: "Returns the number of times a string contains statistics.". |
Of course, here is the Java code you requested:
```java
public static int containRegexStatistics(String srcString, String desString) {
int number = 0;
while (true) {
String newString = srcString.replaceFirst(desString, "");
if (newString.length() == srcString.length()) {
... | Create a Java method that does the following: "This method is used to check if a string contains regular expressions.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
return new StringBuilder()
.append("DISTINCT ")
.append( projection.toQueryString(criteria, queryBuilder) )
.toString();
}
```
Hope this helps! | Create a Java method that does the following: "Get the query string for the IDENTITY". |
Of course, here is the Java code you requested:
```java
public CBConnection connect(String url, String charset) {
this.url = url;
this.charset = charset;
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Connect to a CBSession.". |
Of course, here is the Java code you requested:
```java
public CBConnection header(Map<String, String> header) {
if (header != null) {
this.header = header;
} else {
header.clear();
}
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the header for the CBConnection.". |
Of course, here is the Java code you requested:
```java
public CBConnection header(String key, String value) {
header.put(key, value);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Add a header to the connection.". |
Of course, here is the Java code you requested:
```java
public String execute() throws IOException {
if (CBStringUtil.isEmptyOrNull(this.url)) {
return null;
}
StringBuilder netString = new StringBuilder();
URL url = new URL(this.url);
HttpURLConnection conn = (Htt... | Create a Java method that does the following: "Execute the request.". |
Of course, here is the Java code you requested:
```java
protected CBConnection resetSomeState() {
url = null;
followRedirects = CBDefaultConfig.FOLLOW_REDIRECTS;
header.clear();
data = null;
if (!keepMethod) {
method = CBDefaultConfig.METHOD;
}
if (!k... | Create a Java method that does the following: "Reset some state of the session.". |
Of course, here is the Java code you requested:
```java
public void saveToFile(File file)
throws IOException {
if (CBStringUtil.isEmptyOrNull(this.url)) {
return;
}
URL url = new URL(this.url);
URLConnection conn = url.openConnection();
InputStream is = c... | Create a Java method that does the following: "Saves the current instance of the class to the specified file.". |
Of course, here is the Java code you requested:
```java
private void addPaletteItem(String category,IPaletteItem item){
if(items.get(category)==null){
List<IPaletteItem> list = new ArrayList<IPaletteItem>();
items.put(category,list);
}
List<IPaletteItem> list = items.get(category);
list.add(item);
... | Create a Java method that does the following: "Adds a palette item to the list of palette items.". |
Of course, here is the Java code you requested:
```java
private IPaletteItem[] getPaletteItems(String category){
List<IPaletteItem> list = items.get(category);
if(list==null){
return new IPaletteItem[0];
}
return list.toArray(new IPaletteItem[list.size()]);
}
```
Hope this helps! | Create a Java method that does the following: "Gets the list of items for the given category.". |
Of course, here is the Java code you requested:
```java
private void configureTableResizing(final Composite parent, final Table table, final TableColumn column1, final TableColumn column2) {
parent.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle area = parent.g... | Create a Java method that does the following: "Configures the table resizing.". |
Of course, here is the Java code you requested:
```java
void enableTemplates() {
boolean enabled = fUseTemplateButton.getSelection();
if (!enabled) {
// save last selected template
Template template = getSelectedTemplate();
if (template != null)
fLastSelectedTemplateName = template.getName();
else... | Create a Java method that does the following: "Enable the templates.". |
Of course, here is the Java code you requested:
```java
private Template getSelectedTemplate() {
Template template = null;
IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection();
if (selection.size() == 1) {
template = (Template) selection.getFirstElement();
}
return template... | Create a Java method that does the following: "Get the selected template". |
Of course, here is the Java code you requested:
```java
private void loadLastSavedPreferences() {
fLastSelectedTemplateName = ""; //$NON-NLS-1$
boolean setSelection = false;
String templateName = GlassmakerUIPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
if (t... | Create a Java method that does the following: "Load the last saved preferences.". |
Of course, here is the Java code you requested:
```java
private void setSelectedTemplate(String templateName) {
Object template = null;
if (templateName != null && templateName.length() > 0) {
// pick the last used template
template = fTemplateStore.findTemplate(templateName, CardContextType.CONTEXT_TYPE);
... | Create a Java method that does the following: "Select the selected template.". |
Of course, here is the Java code you requested:
```java
public static Criterion between(String relativePath, Object lo, Object hi) {
return new BetweenExpression(relativePath, lo, hi, false);
}
```
Hope this helps! | Create a Java method that does the following: "Create a Criterion that accepts a relative path between the two given values.". |
Of course, here is the Java code you requested:
```java
public static Criterion notBetween(String relativePath, Object lo, Object hi) {
return new BetweenExpression(relativePath, lo, hi, true);
}
```
Hope this helps! | Create a Java method that does the following: "Not between criterion.". |
Of course, here is the Java code you requested:
```java
public static Conjunction and(Criterion... criterionList) {
Conjunction junction = new Conjunction();
for( Criterion criterion : criterionList ) {
junction.add( criterion );
}
return junction;
}
```
Hope this helps! | Create a Java method that does the following: "Create a Logical And from a list of Criterion objects.". |
Of course, here is the Java code you requested:
```java
public static Disjunction or(Criterion... criterionList) {
Disjunction junction = new Disjunction();
for( Criterion criterion : criterionList ) {
junction.add( criterion );
}
return junction;
}
```
Hope this helps! | Create a Java method that does the following: "Create an OR Disjunction from a list of Criterion objects.". |
Of course, here is the Java code you requested:
```java
public static Criterion in(String relativePath, Collection<?> values) {
return new InExpression(relativePath, values.toArray());
}
```
Hope this helps! | Create a Java method that does the following: "Create an in criterion.". |
Of course, here is the Java code you requested:
```java
public static Criterion memberOf(String relativePath, Object value) {
return new MemberOfExpression(relativePath, value, false);
}
```
Hope this helps! | Create a Java method that does the following: "Create a Criterion that tests if an object is a member of another object.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
// check whether list is empty
if( projectionList.isEmpty() ) {
throw new IllegalStateException("A projection list must have at least one child.");
}
... | Create a Java method that does the following: "Get the query string for the result of the query.". |
Of course, here is the Java code you requested:
```java
public static String md5(String text) {
if (text == null) {
return null;
}
if (text.length() == 0) {
return "";
}
try {
md1.update(text.getBytes("UTF8"));
return hex(md1.diges... | Create a Java method that does the following: "Method to calculate MD5 hash from text.". |
Of course, here is the Java code you requested:
```java
public static boolean hasNewVersion(String oldVersion, String newVersion) {
//版本号有一个不正常就返回false
if (CBStringUtil.isEmptyOrNull(oldVersion) || CBStringUtil.isEmptyOrNull(newVersion)) {
return false;
}
boolean res = fals... | Create a Java method that does the following: "Check if the oldVersion and newVersion are valid". |
Of course, here is the Java code you requested:
```java
public void createFieldEditors() {
addField(new StringFieldEditor(PreferenceConstants.CLIENT_ID, "Google API Client Id:", getFieldEditorParent()));
addField(new StringFieldEditor(PreferenceConstants.CLIENT_SECRET, "Google API Client Secret:", getFieldEditorPa... | Create a Java method that does the following: "Create the field editors.". |
Of course, here is the Java code you requested:
```java
public String toGroupByString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
if(grouped) {
if(absolute) {
return path;
} else {
return queryBuilder.getAbsolutePath(criteria, path);
}
}
return null;
}
```
H... | Create a Java method that does the following: "Returns the path of the path to be used in the GROUP BY clause.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
StringBuilder builder = new StringBuilder();
builder.append( queryBuilder.createPositionalParameter() );
if( negate ) {
builder.append(" NOT");
}
builder... | Create a Java method that does the following: "Returns the query string for the given criteria.". |
Of course, here is the Java code you requested:
```java
public static String generateAlias(String basename, int counter, String fallback) {
// build trimmed and lower case version of the base name
String lowerCaseBaseName = basename.trim().toLowerCase(Locale.ENGLISH);
// use only simple characters fo... | Create a Java method that does the following: "Generate a unique identifier for the base name and counter". |
Of course, here is the Java code you requested:
```java
public static String getLastPathComponent(String path) {
// find last '.' character
int pos = path.lastIndexOf('.');
// return the last path component
// or the complete path, if no '.' chars were found
return pos >= 0 ? path.substri... | Create a Java method that does the following: "Get the last path component in a path string.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
StringBuilder builder = new StringBuilder();
builder.append( "NEW " );
builder.append( clazz.getName() );
builder.append( '(' );
builder.append( projectionLis... | Create a Java method that does the following: "Returns a query string for the generated code.". |
Of course, here is the Java code you requested:
```java
public String toGroupByString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
return projectionList.toGroupByString(criteria, queryBuilder);
}
```
Hope this helps! | Create a Java method that does the following: "Returns a string representation of the group by clause". |
Of course, here is the Java code you requested:
```java
protected void initialPopulateContainerNameField() {
super.initialPopulateContainerNameField();
IPath fullPath = getContainerFullPath();
IProject project = getProjectFromPath(fullPath);
IPath root = ProjectUtils.getRootContainerForPath(project, fullPath)... | Create a Java method that does the following: "Initialize the container name field.". |
Of course, here is the Java code you requested:
```java
String addDefaultExtension(String filename) {
StringBuffer newFileName = new StringBuffer(filename);
String ext = "card";
newFileName.append("."); //$NON-NLS-1$
newFileName.append(ext);
return newFileName.toString();
}
```
Hope this helps! | Create a Java method that does the following: "Add a default extension to the file name.". |
Of course, here is the Java code you requested:
```java
private IProject getProjectFromPath(IPath path) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = null;
if (path != null) {
if (workspace.validatePath(path.toString(), IResource.PROJECT).isOK()) {
project = workspace.getRoo... | Create a Java method that does the following: "Get the project from the given path.". |
Of course, here is the Java code you requested:
```java
public static Criteria createCriteria(EntityManager entityManager,
Class<?> persistentClass) {
errorIfClosed(entityManager);
return new CriteriaImpl( entityManager, persistentClass.getSimpleName() );
}
```
Hope this helps! | Create a Java method that does the following: "Create a Criteria object from a single entity.". |
Of course, here is the Java code you requested:
```java
public static Criteria createCriteria(EntityManager entityManager,
Class<?> persistentClass, String alias) {
return new CriteriaImpl( entityManager, persistentClass.getSimpleName(), alias);
}
```
Hope this helps! | Create a Java method that does the following: "Create a Criteria object from a single entity.". |
Of course, here is the Java code you requested:
```java
public static Criteria createCriteria(EntityManager entityManager,
String entityName, String alias) {
errorIfClosed(entityManager);
return new CriteriaImpl( entityManager, entityName, alias);
}
```
Hope this helps! | Create a Java method that does the following: "Create a Criteria object from a single entity.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
// fallback for empty criteria list
if( criterionList.isEmpty() ) {
return "1=1";
}
// build junction
StringBuilder builder = new StringBuilder... | Create a Java method that does the following: "Get the JPQL string for the specified criteria". |
Of course, here is the Java code you requested:
```java
public AuthorizationCodeFlow newAuthorizationCodeFlow() throws IOException {
return new GoogleAuthorizationCodeFlow.Builder(new NetHttpTransport(), new JacksonFactory(), clientId, clientSecret, Collections.singleton(scope)).setAccessType(accessType).setCredent... | Create a Java method that does the following: "Creates a new AuthorizationCodeFlow object.". |
Of course, here is the Java code you requested:
```java
public String getUserId(HttpServletRequest request) {
HttpSession session = request.getSession();
return (String) session.getAttribute("userId");
}
```
Hope this helps! | Create a Java method that does the following: "Gets the userId from the session.". |
Of course, here is the Java code you requested:
```java
public void doSaveAs() {
IEditorPart editor = getEditor(0);
editor.doSaveAs();
setPageText(0, editor.getTitle());
setInput(editor.getEditorInput());
}
```
Hope this helps! | Create a Java method that does the following: "Save the content of the editor as the first page.". |
Of course, here is the Java code you requested:
```java
public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
if (!(editorInput instanceof IFileEditorInput))
throw new PartInitException("Invalid Input: Must be IFileEditorInput");
super.init(site, editorInput);
}
```
Hope this... | Create a Java method that does the following: "Initialize the part.". |
Of course, here is the Java code you requested:
```java
public static String createQueryLogMessage(String query, List<Object> parameterValues) {
// builder for log message
StringBuilder builder = new StringBuilder();
// log the JPQL query string
builder.append("Query: \"");
builder.append... | Create a Java method that does the following: "Create the query log message.". |
Of course, here is the Java code you requested:
```java
public void insertTimelineItem(TimelineItem item, String attachmentContentType, InputStream attachmentInputStream) throws IOException {
insertTimelineItem(item, attachmentContentType, ByteStreams.toByteArray(attachmentInputStream));
}
```
Hope this helps! | Create a Java method that does the following: "Insert a timeline item into the database.". |
Of course, here is the Java code you requested:
```java
@Override
public void deleteItem(final String name, final String key) {
try {
final CacheResponse response = objectMapper.readValue(
requestFactory.buildDeleteRequest(new CacheItemUrl(hostName, projectId, name, key)).execute()
.getContent(), Ca... | Create a Java method that does the following: "Delete a cache item.". |
Of course, here is the Java code you requested:
```java
@Override
public Optional<Cache> getCache(final String name) {
try {
return Optional.fromNullable(objectMapper.readValue(
requestFactory.buildGetRequest(new CacheUrl(hostName, projectId, name)).execute().getContent(),
Cache.class));
} catch (f... | Create a Java method that does the following: "Gets a cache.". |
Of course, here is the Java code you requested:
```java
@Override
public Optional<CachedItem> getItem(final String name, final String key) {
try {
return Optional.fromNullable(objectMapper.readValue(
requestFactory.buildGetRequest(new CacheItemUrl(hostName, projectId, name, key)).execute()
.getConte... | Create a Java method that does the following: "Gets a cached item.". |
Of course, here is the Java code you requested:
```java
@Override
public void incrementItem(final String name, final String key, final int amount) {
try {
final IncrementCacheResponse response = objectMapper.readValue(
requestFactory
.buildPostRequest(new IncrementCacheItemUrl(hostName, projectId, n... | Create a Java method that does the following: "Increments an item in the cache.". |
Of course, here is the Java code you requested:
```java
private void validate(final CacheResponse response, final String keyword) {
if (!response.getMessage().toLowerCase(Locale.US).startsWith(keyword)) {
throw new IllegalArgumentException(response.getMessage());
}
}
```
Hope this helps! | Create a Java method that does the following: "Validate the response message.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
String absolutePath = queryBuilder.getAbsolutePath(criteria, relativePath);
return ascending ? absolutePath : absolutePath+" DESC";
}
```
Hope this helps! | Create a Java method that does the following: "Returns the query string for the given criteria.". |
Of course, here is the Java code you requested:
```java
public ContextTypeRegistry getTemplateContextRegistry() {
if (fContextTypeRegistry == null) {
ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
registry.addContextType(CardContextType.CONTEXT_TYPE);
fContextTypeRegistry... | Create a Java method that does the following: "Gets the ContextTypeRegistry.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
// replace alias variable by real name
String queryFragment =
jpql.replace( "{alias}", queryBuilder.getRequiredAlias(criteria) );
// process parameters
... | Create a Java method that does the following: "Create a query string from the passed in criteria and CriteriaQueryBuilder.". |
Of course, here is the Java code you requested:
```java
public Map<K, V> getMapSortByValueDown(Map<K, V> sourceMap) {
return sortByValue(sourceMap, GROW_DOWN);
}
```
Hope this helps! | Create a Java method that does the following: "Get map sorted by value down.". |
Of course, here is the Java code you requested:
```java
public Map<K, V> getMapSortByKeyUp(Map<K, V> sourceMap) {
return sortByKey(sourceMap, GROW_UP);
}
```
Hope this helps! | Create a Java method that does the following: "Get a map sorted by key up.". |
Of course, here is the Java code you requested:
```java
public Map<K, V> getMapSortByKeyDown(Map<K, V> sourceMap) {
return sortByKey(sourceMap, GROW_DOWN);
}
```
Hope this helps! | Create a Java method that does the following: "Get a map sorted by key down.". |
Of course, here is the Java code you requested:
```java
private int compareValue(Object v1, Object v2) {
if (v1 instanceof Integer)
return Integer.compare((Integer) v1, (Integer) v2);
if (v1 instanceof Float)
return Float.compare((Float) v1, (Float) v2);
if (v1 instan... | Create a Java method that does the following: "Compare two values of the class.". |
Of course, here is the Java code you requested:
```java
@Override
public void setTimeout(int connectTimeout, int readTimeout) throws IOException {
request.setConfig(RequestConfig.custom().setSocketTimeout(readTimeout).setConnectTimeout(connectTimeout)
.build());
}
```
Hope this helps! | Create a Java method that does the following: "Sets the timeout for the connection.". |
Of course, here is the Java code you requested:
```java
protected IAction getAction(ITextEditor editor, String actionID) {
return (editor == null ? null : editor.getAction(actionID));
}
```
Hope this helps! | Create a Java method that does the following: "Get the action from the editor.". |
Of course, here is the Java code you requested:
```java
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
activeEditorPart = part;
IActionBars actionBars = getActionBars();
if (actionBars != null) {
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) pa... | Create a Java method that does the following: "Sets the active editor part.". |
Of course, here is the Java code you requested:
```java
public static void waitTime(long millis, int nanos) {
try {
Thread.sleep(millis, nanos);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
```
Hope this helps! | Create a Java method that does the following: "Wait for a time in milliseconds.". |
Of course, here is the Java code you requested:
```java
public static String paramsToString(String charset, String... params) {
StringBuffer sb = new StringBuffer();
try {
for (int i = 0; i < params.length - 1; i = i + 1) {
sb.append("&");
sb.append(URLEncode... | Create a Java method that does the following: "Returns a String representation of the parameters.". |
Of course, here is the Java code you requested:
```java
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
String path = queryBuilder.getAbsolutePath(criteria, propertyName);
if( !negate ) {
return path+" IS NULL";
} else {
return path+" IS NOT NULL";
}
}
... | Create a Java method that does the following: "Returns the query string for the given criteria.". |
Of course, here is the Java code you requested:
```java
public synchronized void push() {
times.put(String.format(Locale.CHINA, TIME_KEY, ++count), System.currentTimeMillis());
}
```
Hope this helps! | Create a Java method that does the following: "Pushes a new record to the cache.". |
Of course, here is the Java code you requested:
```java
public void push(String key, long time) {
if (key.startsWith("CB_TIMER")) {
return;
}
times.put(key, time);
}
```
Hope this helps! | Create a Java method that does the following: "Push a time into the cache.". |
Of course, here is the Java code you requested:
```java
public long pop() {
if (count < 0) {
return -1;
}
String key = String.format(Locale.CHINA, TIME_KEY, count);
count--;
return pop(key);
}
```
Hope this helps! | Create a Java method that does the following: "Pop a single entry from the set.". |
Of course, here is the Java code you requested:
```java
public Long get() {
return times.get(String.format(Locale.CHINA, TIME_KEY, count));
}
```
Hope this helps! | Create a Java method that does the following: "Get the count of the record.". |
Of course, here is the Java code you requested:
```java
public static String getFileContent(InputStream is) throws IOException {
BufferedReader buff = new BufferedReader(new InputStreamReader(is,
"UTF-8"));
String content = getContent(buff);
buff.close();
return content;... | Create a Java method that does the following: "Get the content of a file from an input stream.". |
Of course, here is the Java code you requested:
```java
public static byte[] getFileByteContent(InputStream is, String encoding) throws IOException{
byte[] buffer = new byte[1024];
int len;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
while((len = is.read(buffer)) !... | Create a Java method that does the following: "Gets the file byte content.". |
Of course, here is the Java code you requested:
```java
public static void saveContentToFile(String content, String filePath)
throws IOException {
saveContentToFile(content, filePath, DEFAULT_CHARSET);
}
```
Hope this helps! | Create a Java method that does the following: "Saves the content to a file.". |
Of course, here is the Java code you requested:
```java
public static void saveContentToFile(String content, File file)
throws IOException {
saveContentToFile(content, file, DEFAULT_CHARSET, false);
}
```
Hope this helps! | Create a Java method that does the following: "Saves the content to a file.". |
Of course, here is the Java code you requested:
```java
public static void saveContentToFile(String content, File file, boolean append)
throws IOException {
saveContentToFile(content, file, DEFAULT_CHARSET, append);
}
```
Hope this helps! | Create a Java method that does the following: "Saves the content to a file.". |
Of course, here is the Java code you requested:
```java
public static void saveContentToFile(URL url, File file) throws IOException {
InputStream is = url.openStream();
FileOutputStream fos = new FileOutputStream(file);
byte[] b = new byte[1024];
int len;
while ((len = is.read(b... | Create a Java method that does the following: "Saves the content of the URL to the file.". |
Of course, here is the Java code you requested:
```java
public static void saveContentToFile(String content, String filePath,
String encoding) throws IOException {
saveContentToFile(content, new File(filePath), encoding, false);
}
```
Hope this helps! | Create a Java method that does the following: "Saves the content to a file.". |
Of course, here is the Java code you requested:
```java
public static void saveContentToFile(String content, File file,
String encoding, boolean append) throws IOException {
BufferedWriter buff = new BufferedWriter(new OutputStreamWriter(
new FileOutputS... | Create a Java method that does the following: "Saves the content to the file.". |
Of course, here is the Java code you requested:
```java
public void startAllTasks() {
while (queue.size() != 0 && !stopSign) {
ICBTask task = queue.poll();
if (task == null) {
continue;
}
setAndStartTask(task);
}
}
```
Hope this helps... | Create a Java method that does the following: "Start all tasks in the queue.". |
Of course, here is the Java code you requested:
```java
public void startAllTasksAndWaiting() throws InterruptedException {
List<ICBTask> taskList = new ArrayList<>();
while (queue.size() != 0 && !stopSign) {
ICBTask task = queue.poll();
if (task == null) {
conti... | Create a Java method that does the following: "Start all tasks and wait for end.". |
Of course, here is the Java code you requested:
```java
public void stopAllTasks() {
ICBTask task;
stopSign = true;
while ((task = queue.poll()) != null) {
task.stopTask();
}
}
```
Hope this helps! | Create a Java method that does the following: "Stop all the tasks in the queue.". |
Of course, here is the Java code you requested:
```java
@Override
public String encodeURL(String href) throws UnsupportedEncodingException {
return response.encodeURL(
UrlUtils.encodeUrlPath(
href,
response.getCharacterEncoding()
)
);
}
```
Hope this helps! | Create a Java method that does the following: "Override this method to return a URL encoded string.". |
Of course, here is the Java code you requested:
```java
protected void appendLimitAndOffSet(final StringBuilder sql, final Page page) {
sql.append(" LIMIT ").append(page.getPageSize()).append(" OFFSET ").append(page.getOffset());
}
```
Hope this helps! | Create a Java method that does the following: "Append limit and off set.". |
Of course, here is the Java code you requested:
```java
public static DocumentRoot<QName> makeDocument()
{
return DocumentRoot(
NamespaceBindings(SbolTerms.sbol2),
TopLevelDocuments(
TopLevelDocument(
SbolTerms.dnaComponent,
... | Create a Java method that does the following: "Create a DocumentRoot of the type DocumentRoot.". |
Of course, here is the Java code you requested:
```java
public static SchemaCatalog makeCoreSchemaCatalog()
{
return SchemaCatalog(
Sbol2Terms.sbol2.namespacedUri("/schemaexample/core"),
ImportedSchemas(),
DocumentSchemas(
DocumentSchema(
... | Create a Java method that does the following: "Creates a SchemaCatalog for the Core Docs.". |
Of course, here is the Java code you requested:
```java
public static SchemaCatalog makeInstantiationSchemaCatalog()
{
return SchemaCatalog(
Sbol2Terms.sbol2.namespacedUri("/schemaexample/instantiation"),
ImportedSchemas(),
DocumentSchemas(
DocumentSchema(
... | Create a Java method that does the following: "Create a SchemaCatalog for the Instantiation schema.". |
Of course, here is the Java code you requested:
```java
public static SchemaCatalog makeComponentSchemaCatalog()
{
return SchemaCatalog(
Sbol2Terms.sbol2.namespacedUri("/schemaexample/component"),
ImportedSchemas(
Sbol2Terms.sbol2.namespacedUri("/schema/core"),
... | Create a Java method that does the following: "Create a SchemaCatalog for a component.". |
Of course, here is the Java code you requested:
```java
public MavenAggregatedReport createAggregatedAction(final MavenModuleSetBuild build, final Map<MavenModule, List<MavenBuild>> moduleBuilds) {
return new MavenDryResultAction(build, getHealthDescriptor(), defaultEncoding,
new DryResult(bu... | Create a Java method that does the following: "Create aggregated report.". |
Of course, here is the Java code you requested:
```java
@SafeVarargs
public static <N> TopLevelDocuments<N> TopLevelDocuments(TopLevelDocument<N> ... documents) {
return TopLevelDocuments(Arrays.asList(documents));
}
```
Hope this helps! | Create a Java method that does the following: "Gets the Top Level Documents from the given documents.". |
Of course, here is the Java code you requested:
```java
public static <N> NamedProperties<N> NamedProperties(final List<NamedProperty<N>> properties) {
return new NamedProperties.Impl<>(properties);
}
```
Hope this helps! | Create a Java method that does the following: "Returns a new named properties object.". |
Of course, here is the Java code you requested:
```java
public static <N> TopLevelDocument<N> TopLevelDocument(final N type,
final URI identity,
final NamedProperties<N> properties) {
return TopLevelDo... | Create a Java method that does the following: "Create a new TopLevelDocument.". |
Of course, here is the Java code you requested:
```java
public static <N> TopLevelDocument<N> TopLevelDocument(final NamespaceBindings bindings,
final N type,
final URI identity) {
return TopLevelDocum... | Create a Java method that does the following: "Gets a new TopLevelDocument.". |
Of course, here is the Java code you requested:
```java
public static <N> NestedDocument<N> NestedDocument(final N type,
final URI identity,
final NamedProperties<N> properties) {
return NestedDocument(Namespa... | Create a Java method that does the following: "Create a new document with a nested document type identity and properties.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.