本文整理了Java中org.apache.wicket.util.lang.Bytes.toString()
方法的一些代码示例,展示了Bytes.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.toString()
方法的具体详情如下:
包路径:org.apache.wicket.util.lang.Bytes
类名称:Bytes
方法名:toString
[英]Converts this byte count to a string using the default locale.
[中]使用默认区域设置将此字节计数转换为字符串。
代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket
/**
* Converts this byte count to a string using the default locale.
*
* @return The string for this byte count
*/
public String toString()
{
return toString(Locale.getDefault());
}
代码示例来源:origin: apache/wicket
@Override
public String getObject()
{
Bytes sessionSizeInBytes = size.getObject();
String sessionSizeAsString = sessionSizeInBytes != null
? sessionSizeInBytes.toString() : "unknown";
return "Session: " + sessionSizeAsString;
}
代码示例来源:origin: org.apache.wicket/wicket-util
/**
* Converts this byte count to a string using the default locale.
*
* @return The string for this byte count
*/
@Override
public String toString()
{
return toString(Locale.getDefault(Locale.Category.FORMAT));
}
代码示例来源:origin: org.apache.wicket/wicket-devutils
@Override
public String getObject()
{
Bytes sessionSizeInBytes = size.getObject();
String sessionSizeAsString = sessionSizeInBytes != null
? sessionSizeInBytes.toString() : "unknown";
return "Session: " + sessionSizeAsString;
}
代码示例来源:origin: org.opensingular/wicket-utils
private String bytesToString(long bytes){
if (bytes < 0){
return "?";
} else {
return Bytes.bytes(bytes).toString();
}
}
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
/**
* @return human readable string of bytes uploaded so far
*/
public String getBytesUploadedString()
{
return Bytes.bytes(bytesUploaded).toString();
}
代码示例来源:origin: apache/wicket
@Override
public String getDefaultMaximumUploadSize()
{
return application.getApplicationSettings().getDefaultMaximumUploadSize().toString();
}
代码示例来源:origin: apache/wicket
@Override
public void populateItem(Item<ICellPopulator<TreeNode>> item, String componentId,
IModel<TreeNode> rowModel)
{
item.add(new Label(componentId, Bytes.bytes(rowModel.getObject().getSize())
.toString()));
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
private void validateMaxFileSize(final FileUpload upload) {
Bytes fileSize = Bytes.bytes(upload.getSize());
final Bytes maxFileSize = Bytes.valueOf(values.getString(MAX_FILE_SIZE, getDefaultMaxFileSize()));
if (maxFileSize.compareTo(fileSize) == -1) {
addViolation("file.validation.size",
upload.getClientFileName(), fileSize.toString(), maxFileSize.toString());
if (log.isDebugEnabled()) {
log.debug("File '{}' has size {} which is too big. The maximum size allowed is {}",
upload.getClientFileName(), fileSize.toString(), maxFileSize.toString());
}
}
}
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
/**
* @return transfer rate in a human readable string
*/
public String getTransferRateString()
{
return Bytes.bytes(getTransferRateBPS()).toString() + "/s";
}
代码示例来源:origin: apache/wicket
@Override
public String getObject()
{
Page enclosingPage = getPage();
long pageSize = WicketObjects.sizeof(enclosingPage);
Bytes pageSizeInBytes = (pageSize > -1 ? Bytes.bytes(pageSize) : null);
String pageSizeAsString = pageSizeInBytes != null ? pageSizeInBytes.toString()
: "unknown";
return "Page: " + pageSizeAsString;
}
};
代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket
/**
* Populate the table with Wicket elements
*/
protected void populateItem(final ListItem listItem)
{
final ComponentData componentData = (ComponentData)listItem.getModelObject();
listItem.add(new Label("row", Integer.toString(listItem.getIndex() + 1)));
listItem.add(new Label("path", componentData.path));
listItem.add(new Label("size", Bytes.bytes(componentData.size).toString()));
listItem.add(new Label("type", componentData.type));
listItem.add(new Label("model", componentData.value));
}
});
代码示例来源:origin: apache/wicket
/**
* @return human readable string of total number of bytes
*/
public String getTotalBytesString()
{
return Bytes.bytes(totalBytes).toString(Session.get().getLocale());
}
代码示例来源:origin: org.apache.wicket/wicket-core
/**
* @return human readable string of total number of bytes
*/
public String getTotalBytesString()
{
return Bytes.bytes(totalBytes).toString(Session.get().getLocale());
}
代码示例来源:origin: apache/wicket
/**
* @return human readable string of bytes uploaded so far
*/
public String getBytesUploadedString()
{
return Bytes.bytes(bytesUploaded).toString(Session.get().getLocale());
}
代码示例来源:origin: org.apache.wicket/wicket-devutils
@Override
public String getObject()
{
Page enclosingPage = getPage();
long pageSize = WicketObjects.sizeof(enclosingPage);
Bytes pageSizeInBytes = (pageSize > -1 ? Bytes.bytes(pageSize) : null);
String pageSizeAsString = pageSizeInBytes != null ? pageSizeInBytes.toString()
: "unknown";
return "Page: " + pageSizeAsString;
}
};
代码示例来源:origin: org.apache.wicket/wicket-core
/**
* @return human readable string of bytes uploaded so far
*/
public String getBytesUploadedString()
{
return Bytes.bytes(bytesUploaded).toString(Session.get().getLocale());
}
代码示例来源:origin: apache/wicket
/**
* @return transfer rate in a human readable string
*/
public String getTransferRateString()
{
return Bytes.bytes(getTransferRateBPS()).toString(Session.get().getLocale()) + "/s";
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
/**
* Check if the defaultMaximumUploadSize stored in the IApplicationSettings is set explicitly and only
* then used it, otherwise use DEFAULT_MAX_FILE_SIZE. This is because it is set to Bytes.MAX
* by default which is a bit overkill (8388608T).
*
* @return The String value of the default maximum file size for an upload
*/
protected String getDefaultMaxFileSize() {
IApplicationSettings settings = Application.get().getApplicationSettings();
Bytes defaultSize = settings.getDefaultMaximumUploadSize();
return Bytes.MAX.equals(defaultSize) ? DEFAULT_MAX_FILE_SIZE : defaultSize.toString();
}
代码示例来源:origin: org.apache.wicket/wicket-core
/**
* @return transfer rate in a human readable string
*/
public String getTransferRateString()
{
return Bytes.bytes(getTransferRateBPS()).toString(Session.get().getLocale()) + "/s";
}
内容来源于网络,如有侵权,请联系作者删除!