org.joda.time.format.DateTimeFormatter.requirePrinter()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.joda.time.format.DateTimeFormatter.requirePrinter()方法的一些代码示例,展示了DateTimeFormatter.requirePrinter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTimeFormatter.requirePrinter()方法的具体详情如下:
包路径:org.joda.time.format.DateTimeFormatter
类名称:DateTimeFormatter
方法名:requirePrinter

DateTimeFormatter.requirePrinter介绍

[英]Checks whether printing is supported.
[中]检查是否支持打印。

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Prints a ReadablePartial.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param appendable  the destination to format to, not null
 * @param partial  partial to format
 * @since 2.0
 */
public void printTo(Appendable appendable, ReadablePartial partial) throws IOException {
  InternalPrinter printer = requirePrinter();
  if (partial == null) {
    throw new IllegalArgumentException("The partial must not be null");
  }
  printer.printTo(appendable, partial, iLocale);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Prints a ReadablePartial.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param appendable  the destination to format to, not null
 * @param partial  partial to format
 * @since 2.0
 */
public void printTo(Appendable appendable, ReadablePartial partial) throws IOException {
  InternalPrinter printer = requirePrinter();
  if (partial == null) {
    throw new IllegalArgumentException("The partial must not be null");
  }
  printer.printTo(appendable, partial, iLocale);
}

代码示例来源:origin: joda-time/joda-time

/**
 * Prints a millisecond instant to a String.
 * <p>
 * This method will use the override zone and the override chronology if
 * they are set. Otherwise it will use the ISO chronology and default zone.
 *
 * @param instant  millis since 1970-01-01T00:00:00Z
 * @return the printed result
 */
public String print(long instant) {
  StringBuilder buf = new StringBuilder(requirePrinter().estimatePrintedLength());
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
  return buf.toString();
}

代码示例来源:origin: joda-time/joda-time

/**
 * Prints a ReadablePartial to a new String.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param partial  partial to format
 * @return the printed result
 */
public String print(ReadablePartial partial) {
  StringBuilder buf = new StringBuilder(requirePrinter().estimatePrintedLength());
  try {
    printTo((Appendable) buf, partial);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
  return buf.toString();
}

代码示例来源:origin: joda-time/joda-time

/**
 * Prints a ReadableInstant to a String.
 * <p>
 * This method will use the override zone and the override chronology if
 * they are set. Otherwise it will use the chronology and zone of the instant.
 *
 * @param instant  instant to format, null means now
 * @return the printed result
 */
public String print(ReadableInstant instant) {
  StringBuilder buf = new StringBuilder(requirePrinter().estimatePrintedLength());
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
  return buf.toString();
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Prints a ReadableInstant to a String.
 * <p>
 * This method will use the override zone and the override chronology if
 * they are set. Otherwise it will use the chronology and zone of the instant.
 *
 * @param instant  instant to format, null means now
 * @return the printed result
 */
public String print(ReadableInstant instant) {
  StringBuilder buf = new StringBuilder(requirePrinter().estimatePrintedLength());
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
  return buf.toString();
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Prints a millisecond instant to a String.
 * <p>
 * This method will use the override zone and the override chronology if
 * they are set. Otherwise it will use the ISO chronology and default zone.
 *
 * @param instant  millis since 1970-01-01T00:00:00Z
 * @return the printed result
 */
public String print(long instant) {
  StringBuilder buf = new StringBuilder(requirePrinter().estimatePrintedLength());
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
  return buf.toString();
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Prints a ReadablePartial to a new String.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param partial  partial to format
 * @return the printed result
 */
public String print(ReadablePartial partial) {
  StringBuilder buf = new StringBuilder(requirePrinter().estimatePrintedLength());
  try {
    printTo((Appendable) buf, partial);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
  return buf.toString();
}

代码示例来源:origin: joda-time/joda-time

private void printTo(Appendable appendable, long instant, Chronology chrono) throws IOException {
  InternalPrinter printer = requirePrinter();
  chrono = selectChronology(chrono);
  // Shift instant into local time (UTC) to avoid excessive offset
  // calculations when printing multiple fields in a composite printer.
  DateTimeZone zone = chrono.getZone();
  int offset = zone.getOffset(instant);
  long adjustedInstant = instant + offset;
  if ((instant ^ adjustedInstant) < 0 && (instant ^ offset) >= 0) {
    // Time zone offset overflow, so revert to UTC.
    zone = DateTimeZone.UTC;
    offset = 0;
    adjustedInstant = instant;
  }
  printer.printTo(appendable, adjustedInstant, chrono.withUTC(), offset, zone, iLocale);
}

代码示例来源:origin: JodaOrg/joda-time

private void printTo(Appendable appendable, long instant, Chronology chrono) throws IOException {
  InternalPrinter printer = requirePrinter();
  chrono = selectChronology(chrono);
  // Shift instant into local time (UTC) to avoid excessive offset
  // calculations when printing multiple fields in a composite printer.
  DateTimeZone zone = chrono.getZone();
  int offset = zone.getOffset(instant);
  long adjustedInstant = instant + offset;
  if ((instant ^ adjustedInstant) < 0 && (instant ^ offset) >= 0) {
    // Time zone offset overflow, so revert to UTC.
    zone = DateTimeZone.UTC;
    offset = 0;
    adjustedInstant = instant;
  }
  printer.printTo(appendable, adjustedInstant, chrono.withUTC(), offset, zone, iLocale);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Prints a ReadablePartial.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param buf  the destination to format to, not null
 * @param partial  partial to format
 */
public void printTo(StringBuffer buf, ReadablePartial partial) {
  DateTimePrinter printer = requirePrinter();
  if (partial == null) {
    throw new IllegalArgumentException("The partial must not be null");
  }
  printer.printTo(buf, partial, iLocale);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Prints a ReadablePartial.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param out  the destination to format to, not null
 * @param partial  partial to format
 */
public void printTo(Writer out, ReadablePartial partial) throws IOException {
  DateTimePrinter printer = requirePrinter();
  if (partial == null) {
    throw new IllegalArgumentException("The partial must not be null");
  }
  printer.printTo(out, partial, iLocale);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Prints a ReadableInstant to a String.
 * <p>
 * This method will use the override zone and the override chronololgy if
 * they are set. Otherwise it will use the chronology and zone of the instant.
 *
 * @param instant  instant to format, null means now
 * @return the printed result
 */
public String print(ReadableInstant instant) {
  StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
  printTo(buf, instant);
  return buf.toString();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Prints a ReadablePartial to a new String.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param partial  partial to format
 * @return the printed result
 */
public String print(ReadablePartial partial) {
  StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
  printTo(buf, partial);
  return buf.toString();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Prints a millisecond instant to a String.
 * <p>
 * This method will use the override zone and the override chronololgy if
 * they are set. Otherwise it will use the ISO chronology and default zone.
 *
 * @param instant  millis since 1970-01-01T00:00:00Z
 * @return the printed result
 */
public String print(long instant) {
  StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
  printTo(buf, instant);
  return buf.toString();
}

代码示例来源:origin: camunda/camunda-bpm-platform

private void printTo(Writer buf, long instant, Chronology chrono) throws IOException {
  DateTimePrinter printer = requirePrinter();
  chrono = selectChronology(chrono);
  // Shift instant into local time (UTC) to avoid excessive offset
  // calculations when printing multiple fields in a composite printer.
  DateTimeZone zone = chrono.getZone();
  int offset = zone.getOffset(instant);
  long adjustedInstant = instant + offset;
  if ((instant ^ adjustedInstant) < 0 && (instant ^ offset) >= 0) {
    // Time zone offset overflow, so revert to UTC.
    zone = DateTimeZone.UTC;
    offset = 0;
    adjustedInstant = instant;
  }
  printer.printTo(buf, adjustedInstant, chrono.withUTC(), offset, zone, iLocale);
}

代码示例来源:origin: camunda/camunda-bpm-platform

private void printTo(StringBuffer buf, long instant, Chronology chrono) {
  DateTimePrinter printer = requirePrinter();
  chrono = selectChronology(chrono);
  // Shift instant into local time (UTC) to avoid excessive offset
  // calculations when printing multiple fields in a composite printer.
  DateTimeZone zone = chrono.getZone();
  int offset = zone.getOffset(instant);
  long adjustedInstant = instant + offset;
  if ((instant ^ adjustedInstant) < 0 && (instant ^ offset) >= 0) {
    // Time zone offset overflow, so revert to UTC.
    zone = DateTimeZone.UTC;
    offset = 0;
    adjustedInstant = instant;
  }
  printer.printTo(buf, adjustedInstant, chrono.withUTC(), offset, zone, iLocale);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Prints a ReadablePartial to a new String.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param partial  partial to format
 * @return the printed result
 */
public String print(ReadablePartial partial) {
  StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
  printTo(buf, partial);
  return buf.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Prints a millisecond instant to a String.
 * <p>
 * This method will use the override zone and the override chronololgy if
 * they are set. Otherwise it will use the ISO chronology and default zone.
 *
 * @param instant  millis since 1970-01-01T00:00:00Z
 * @return the printed result
 */
public String print(long instant) {
  StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
  printTo(buf, instant);
  return buf.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Prints a ReadablePartial to a new String.
 * <p>
 * Neither the override chronology nor the override zone are used
 * by this method.
 *
 * @param partial  partial to format
 * @return the printed result
 */
public String print(ReadablePartial partial) {
  StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
  printTo(buf, partial);
  return buf.toString();
}

相关文章