本文整理了Java中javax.mail.Quota
类的一些代码示例,展示了Quota
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota
类的具体详情如下:
包路径:javax.mail.Quota
类名称:Quota
[英]This class represents a set of quotas for a given quota root. Each quota root has a set of resources, represented by the Quota.Resource
class. Each resource has a name (for example, "STORAGE"), a current usage, and a usage limit. See RFC 2087.
[中]此类表示给定配额根的一组配额。每个配额根都有一组资源,由Quota.Resource
类表示。每个资源都有一个名称(例如,“存储”)、当前使用情况和使用限制。见RFC 2087。
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
List<Quota.Resource> v = new ArrayList<>();
while (!r.isNextNonSpace(')')) {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.add(res);
}
}
q.resources = v.toArray(new Quota.Resource[v.size()]);
return q;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Set a limit value for a resource. If the resource is not
* currently associated with this Quota, a new Resource item is
* added to the resources list.
*
* @param name The target resource name.
* @param limit The new limit value for the resource.
*/
public void setResourceLimit(String name, long limit) {
Resource target = findResource(name);
target.limit = limit;
}
代码示例来源:origin: greenmail-mail-test/greenmail
@Override
protected void doProcess(final ImapRequestLineReader request, final ImapResponse response,
final ImapSession session) {
if(!session.getHost().getStore().isQuotaSupported()) {
response.commandFailed(this,"Quota is not supported. Activate quota capability first");
}
try {
String root = parser.mailbox(request);
Quota quota = new Quota(root);
parser.consumeChar(request, ' ');
parser.consumeChar(request, '(');
quota.setResourceLimit(parser.astring(request), parser.consumeLong(request));
char c =request.nextWordChar();
if(')' != c) {
quota.setResourceLimit(parser.astring(request), parser.consumeLong(request));
}
parser.consumeChar(request, ')');
session.getHost().getStore().setQuota(
quota, session.getUser().getQualifiedMailboxName());
response.commandComplete(this);
} catch (ProtocolException e) {
response.commandFailed(this, "Can not parse command"+e.getMessage());
}
}
}
代码示例来源:origin: com.sun.mail/javax.mail
while ((root = ir.readAtomString()) != null &&
root.length() > 0)
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
List<Quota.Resource> v = new ArrayList<Quota.Resource>();
while (r.peekByte() != ')') {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.add(res);
}
}
r.readByte();
q.resources = v.toArray(new Quota.Resource[v.size()]);
return q;
}
代码示例来源:origin: camunda/camunda-bpm-platform
while ((root = ir.readAtomString()) != null &&
root.length() > 0)
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: org.apache.geronimo.javamail/geronimo-javamail_1.4_provider
quota = new Quota(tokenName);
代码示例来源:origin: org.glassfish.metro/webservices-extra
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
List<Quota.Resource> v = new ArrayList<>();
while (!r.isNextNonSpace(')')) {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.add(res);
}
}
q.resources = v.toArray(new Quota.Resource[v.size()]);
return q;
}
代码示例来源:origin: com.sun.mail/android-mail
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
List<Quota.Resource> v = new ArrayList<>();
while (!r.isNextNonSpace(')')) {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.add(res);
}
}
q.resources = v.toArray(new Quota.Resource[v.size()]);
return q;
}
代码示例来源:origin: com.sun.mail/jakarta.mail
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
List<Quota.Resource> v = new ArrayList<>();
while (!r.isNextNonSpace(')')) {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.add(res);
}
}
q.resources = v.toArray(new Quota.Resource[v.size()]);
return q;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
Vector v = new Vector();
while (r.peekByte() != ')') {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.addElement(res);
}
}
r.readByte();
q.resources = new Quota.Resource[v.size()];
v.copyInto(q.resources);
return q;
}
代码示例来源:origin: com.sun.mail/jakarta.mail
while ((root = ir.readAtomString()) != null &&
root.length() > 0)
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: jboss/jboss-javaee-specs
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
List<Quota.Resource> v = new ArrayList<>();
while (!r.isNextNonSpace(')')) {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.add(res);
}
}
q.resources = v.toArray(new Quota.Resource[v.size()]);
return q;
}
代码示例来源:origin: com.sun.mail/android-mail
while ((root = ir.readAtomString()) != null &&
root.length() > 0)
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: javax.mail/com.springsource.javax.mail
/**
* Parse a QUOTA response.
*/
private Quota parseQuota(Response r) throws ParsingException {
// quota_response ::= "QUOTA" SP astring SP quota_list
String quotaRoot = r.readAtomString(); // quotaroot ::= astring
Quota q = new Quota(quotaRoot);
r.skipSpaces();
// quota_list ::= "(" #quota_resource ")"
if (r.readByte() != '(')
throw new ParsingException("parse error in QUOTA");
Vector v = new Vector();
while (r.peekByte() != ')') {
// quota_resource ::= atom SP number SP number
String name = r.readAtom();
if (name != null) {
long usage = r.readLong();
long limit = r.readLong();
Quota.Resource res = new Quota.Resource(name, usage, limit);
v.addElement(res);
}
}
r.readByte();
q.resources = new Quota.Resource[v.size()];
v.copyInto(q.resources);
return q;
}
代码示例来源:origin: jboss/jboss-javaee-specs
while ((root = ir.readAtomString()) != null &&
root.length() > 0)
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: org.glassfish.metro/webservices-extra
while ((root = ir.readAtomString()) != null &&
root.length() > 0)
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: javax.mail/com.springsource.javax.mail
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
tab.put(root, new Quota(root));
r[i] = null;
} else if (ir.keyEquals("QUOTA")) {
内容来源于网络,如有侵权,请联系作者删除!