本文整理汇总了Java中javax.print.attribute.standard.JobOriginatingUserName类的典型用法代码示例。如果您正苦于以下问题:Java JobOriginatingUserName类的具体用法?Java JobOriginatingUserName怎么用?Java JobOriginatingUserName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobOriginatingUserName类属于javax.print.attribute.standard包,在下文中一共展示了JobOriginatingUserName类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import javax.print.attribute.standard.JobOriginatingUserName; //导入依赖的package包/类
/**
* Writes an attribute in TextSyntax into the stream.
* <p>
* By default attributes are qritten as TEXT_WITHOUT_LANGUAGE value-tag.
* As some attributes in the JPS are TextSyntax attributes but actually
* of NAME value-tag in IPP this method checks for these attributes and
* writes them as NAME_WITHOUT_LANGUAGE value-tag into the stream.
* </p>
*
* @param attribute the attribute
* @param out the stream to write to
* @throws IOException if thrown by the stream
*/
private void write(TextSyntax attribute) throws IOException
{
// We only use *WithoutLanguage, correct according to spec.
String name = ((Attribute) attribute).getName();
if (attribute instanceof RequestingUserName
|| attribute instanceof JobName
|| attribute instanceof DocumentName
|| attribute instanceof JobOriginatingUserName)
out.writeByte(IppValueTag.NAME_WITHOUT_LANGUAGE);
else if (attribute instanceof DocumentFormat)
out.writeByte(IppValueTag.MIME_MEDIA_TYPE);
else
out.writeByte(IppValueTag.TEXT_WITHOUT_LANGUAGE);
out.writeShort(name.length());
out.write(name.getBytes());
out.writeShort(attribute.getValue().length());
out.write(attribute.getValue().getBytes());
}
示例2: write
import javax.print.attribute.standard.JobOriginatingUserName; //导入依赖的package包/类
/**
* Writes an attribute in TextSyntax into the stream.
* <p>
* By default attributes are qritten as TEXT_WITHOUT_LANGUAGE value-tag.
* As some attributes in the JPS are TextSyntax attributes but actually
* of NAME value-tag in IPP this method checks for these attributes and
* writes them as NAME_WITHOUT_LANGUAGE value-tag into the stream.
* </p>
*
* @param attribute the attribute
* @param out the stream to write to
* @throws IOException if thrown by the stream
*/
private void write(TextSyntax attribute) throws IOException
{
// We only use *WithoutLanguage, correct according to spec.
String name = ((Attribute) attribute).getName();
if (attribute instanceof RequestingUserName
|| attribute instanceof JobName
|| attribute instanceof DocumentName
|| attribute instanceof JobOriginatingUserName)
out.writeByte(IppValueTag.NAME_WITHOUT_LANGUAGE);
else if (attribute instanceof DocumentFormat)
out.writeByte(IppValueTag.MIME_MEDIA_TYPE);
else
out.writeByte(IppValueTag.TEXT_WITHOUT_LANGUAGE);
out.writeShort(name.length());
out.write(name.getBytes());
out.writeShort(attribute.getValue().length());
out.write(attribute.getValue().getBytes());
}