本文整理了Java中com.sun.mail.iap.Argument
类的一些代码示例,展示了Argument
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Argument
类的具体详情如下:
包路径:com.sun.mail.iap.Argument
类名称:Argument
暂无
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Generate a QRESYNC argument list based on the ResyncData.
*/
private static Argument resyncArgs(ResyncData rd) {
Argument cmd = new Argument();
cmd.writeAtom("QRESYNC");
Argument args = new Argument();
args.writeNumber(rd.getUIDValidity());
args.writeNumber(rd.getModSeq());
UIDSet[] uids = Utility.getResyncUIDSet(rd);
if (uids != null)
args.writeString(UIDSet.toString(uids));
cmd.writeArgument(args);
return cmd;
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected Argument not(NotTerm term, String charset)
throws SearchException, IOException {
Argument result = new Argument();
// Add the NOT search-key
result.writeAtom("NOT");
/* If this term is an AND expression, we need to enclose it
* within paranthesis.
*
* AND expressions are either AndTerms or FlagTerms
*/
SearchTerm nterm = term.getTerm();
if (nterm instanceof AndTerm || nterm instanceof FlagTerm)
result.writeArgument(generateSequence(nterm, charset));
else
result.append(generateSequence(nterm, charset));
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void write(Protocol protocol)
throws IOException, ProtocolException {
int size = items != null ? items.size() : 0;
DataOutputStream os = (DataOutputStream)protocol.getOutputStream();
for (int i=0; i < size; i++) {
if (i > 0) // write delimiter if not the first item
os.write(' ');
Object o = items.get(i);
if (o instanceof Atom) {
os.writeBytes(((Atom)o).string);
} else if (o instanceof Number) {
os.writeBytes(((Number)o).toString());
} else if (o instanceof AString) {
astring(((AString)o).bytes, protocol);
} else if (o instanceof NString) {
nstring(((NString)o).bytes, protocol);
} else if (o instanceof byte[]) {
literal((byte[])o, protocol);
} else if (o instanceof ByteArrayOutputStream) {
literal((ByteArrayOutputStream)o, protocol);
} else if (o instanceof Literal) {
literal((Literal)o, protocol);
} else if (o instanceof Argument) {
os.write('('); // open parans
((Argument)o).write(protocol);
os.write(')'); // close parans
}
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected Argument from(String address, String charset)
throws SearchException, IOException {
Argument result = new Argument();
result.writeAtom("FROM");
result.writeString(address, charset);
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Generate argument for YoungerTerm.
*
* @param term the search term
* @return the SEARCH Argument
* @exception SearchException for failures
* @since JavaMail 1.5.1
*/
protected Argument younger(YoungerTerm term) throws SearchException {
Argument result = new Argument();
result.writeAtom("YOUNGER");
result.writeNumber(term.getInterval());
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Convert the client parameters into an argument list for the ID command.
*/
static Argument getArgumentList(Map<String,String> clientParams) {
Argument arg = new Argument();
if (clientParams == null) {
arg.writeAtom("NIL");
return arg;
}
Argument list = new Argument();
// add params to list
for (Map.Entry<String, String> e : clientParams.entrySet()) {
list.writeNString(e.getKey());
list.writeNString(e.getValue());
}
arg.writeArgument(list);
return arg;
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
Argument args = new Argument();
args.writeString(mbox);
args.writeAtom(createFlagList(f));
args.writeString(INTERNALDATE.format(d));
args.writeBytes(data);
代码示例来源:origin: com.sun.mail/javax.mail
Argument args = new Argument();
writeMailboxName(args, mbox);
if (!hasCapability("CONDSTORE"))
throw new BadCommandException("CONDSTORE not supported");
args.writeArgument(new Argument().writeAtom("CONDSTORE"));
} else {
if (!hasCapability("QRESYNC"))
throw new BadCommandException("QRESYNC not supported");
args.writeArgument(resyncArgs(rd));
代码示例来源:origin: javax.mail/com.springsource.javax.mail
public void write(Protocol protocol)
throws IOException, ProtocolException {
int size = items != null ? items.size() : 0;
DataOutputStream os = (DataOutputStream)protocol.getOutputStream();
for (int i=0; i < size; i++) {
if (i > 0) // write delimiter if not the first item
os.write(' ');
Object o = items.elementAt(i);
if (o instanceof Atom) {
os.writeBytes(((Atom)o).string);
} else if (o instanceof Number) {
os.writeBytes(((Number)o).toString());
} else if (o instanceof AString) {
astring(((AString)o).bytes, protocol);
} else if (o instanceof byte[]) {
literal((byte[])o, protocol);
} else if (o instanceof ByteArrayOutputStream) {
literal((ByteArrayOutputStream)o, protocol);
} else if (o instanceof Literal) {
literal((Literal)o, protocol);
} else if (o instanceof Argument) {
os.write('('); // open parans
((Argument)o).write(protocol);
os.write(')'); // close parans
}
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Write out given byte[] as a literal
*/
private void literal(byte[] b, Protocol protocol)
throws IOException, ProtocolException {
startLiteral(protocol, b.length).write(b);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* PROXYAUTH Command.
*
* @param u the PROXYAUTH user name
* @exception ProtocolException for protocol failures
* @see "Netscape/iPlanet/SunONE Messaging Server extension"
*/
public void proxyauth(String u) throws ProtocolException {
Argument args = new Argument();
args.writeString(u);
simpleCommand("PROXYAUTH", args);
proxyAuthUser = u;
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected Argument and(AndTerm term, String charset)
throws SearchException, IOException {
// Combine the sequences for both terms
SearchTerm[] terms = term.getTerms();
// Generate the search sequence for the first term
Argument result = generateSequence(terms[0], charset);
// Append other terms
for (int i = 1; i < terms.length; i++)
result.append(generateSequence(terms[i], charset));
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public String writeCommand(String command, Argument args)
throws IOException, ProtocolException {
// assert Thread.holdsLock(this);
// can't assert because it's called from constructor
String tag = "A" + Integer.toString(tagCounter++, 10); // unique tag
output.writeBytes(tag + " " + command);
if (args != null) {
output.write(' ');
args.write(this);
}
output.write(CRLF);
output.flush();
return tag;
}
代码示例来源:origin: camunda/camunda-bpm-platform
literal(bytes, protocol);
return;
if (b == '\0' || b == '\r' || b == '\n' || ((b & 0xff) > 0177)) {
literal(bytes, protocol);
return;
代码示例来源:origin: com.sun.mail/javax.mail
/**
* DELETE Command.
*
* @param mbox the mailbox to delete
* @exception ProtocolException for protocol failures
* @see "RFC2060, section 6.3.4"
*/
public void delete(String mbox) throws ProtocolException {
Argument args = new Argument();
writeMailboxName(args, mbox);
simpleCommand("DELETE", args);
}
代码示例来源:origin: com.sun.mail/javax.mail
public AppendUID appenduid(String mbox, Flags f, Date d,
Literal data, boolean uid) throws ProtocolException {
Argument args = new Argument();
writeMailboxName(args, mbox);
args.writeAtom(createFlagList(f));
args.writeString(INTERNALDATE.format(d));
args.writeBytes(data);
代码示例来源:origin: com.sun.mail/javax.mail
protected Argument from(String address, String charset)
throws SearchException, IOException {
Argument result = new Argument();
result.writeAtom("FROM");
result.writeString(address, charset);
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Generate argument for OlderTerm.
*
* @param term the search term
* @return the SEARCH Argument
* @exception SearchException for failures
* @since JavaMail 1.5.1
*/
protected Argument older(OlderTerm term) throws SearchException {
Argument result = new Argument();
result.writeAtom("OLDER");
result.writeNumber(term.getInterval());
return result;
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Convert the client parameters into an argument list for the ID command.
*/
static Argument getArgumentList(Map<String,String> clientParams) {
Argument arg = new Argument();
if (clientParams == null) {
arg.writeAtom("NIL");
return arg;
}
Argument list = new Argument();
// add params to list
for (Map.Entry<String, String> e : clientParams.entrySet()) {
list.writeNString(e.getKey()); // assume these are ASCII only
list.writeNString(e.getValue());
}
arg.writeArgument(list);
return arg;
}
}
代码示例来源:origin: com.sun.mail/javax.mail
Argument args = new Argument();
writeMailboxName(args, mbox);
if (!hasCapability("CONDSTORE"))
throw new BadCommandException("CONDSTORE not supported");
args.writeArgument(new Argument().writeAtom("CONDSTORE"));
} else {
if (!hasCapability("QRESYNC"))
throw new BadCommandException("QRESYNC not supported");
args.writeArgument(resyncArgs(rd));
内容来源于网络,如有侵权,请联系作者删除!