Java 类javax.print.attribute.standard.JobOriginatingUserName 实例源码

项目:javify    文件:IppRequest.java   
/**
 * 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());
}
项目:jvm-stm    文件:IppRequest.java   
/**
 * 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());     
}
项目:JamVM-PH    文件:IppRequest.java   
/**
 * 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());     
}
项目:classpath    文件:IppRequest.java   
/**
 * 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());
}