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

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

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

DateTimeFormatter.printTo介绍

[英]Prints an instant from milliseconds since 1970-01-01T00:00:00Z, using ISO chronology in the default DateTimeZone.
[中]打印自1970-01-01T00:00:00Z以来的毫秒数,使用默认日期时区中的ISO时间顺序。

代码示例

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

/**
 * Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
 * using ISO chronology in the default DateTimeZone.
 *
 * @param appendable  the destination to format to, not null
 * @param instant  millis since 1970-01-01T00:00:00Z
 * @since 2.0
 */
public void printTo(Appendable appendable, long instant) throws IOException {
  printTo(appendable, instant, null);
}

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

/**
 * 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 {
  printTo((Appendable) out, partial);
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param out  the destination to format to, not null
 * @param instant  instant to format, null means now
 */
public void printTo(Writer out, ReadableInstant instant) throws IOException {
  printTo((Appendable) out, instant);
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param buf  the destination to format to, not null
 * @param instant  instant to format, null means now
 */
public void printTo(StringBuffer buf, ReadableInstant instant) {
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuffer does not throw IOException
  }
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param buf  the destination to format to, not null
 * @param instant  instant to format, null means now
 */
public void printTo(StringBuilder buf, ReadableInstant instant) {
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param out  the destination to format to, not null
 * @param instant  instant to format, null means now
 */
public void printTo(Writer out, ReadableInstant instant) throws IOException {
  printTo((Appendable) out, instant);
}

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

/**
 * Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
 * using ISO chronology in the default DateTimeZone.
 *
 * @param out  the destination to format to, not null
 * @param instant  millis since 1970-01-01T00:00:00Z
 */
public void printTo(Writer out, long instant) throws IOException {
  printTo((Appendable) out, instant);
}

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

/**
 * Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
 * using ISO chronology in the default DateTimeZone.
 *
 * @param out  the destination to format to, not null
 * @param instant  millis since 1970-01-01T00:00:00Z
 */
public void printTo(Writer out, long instant) throws IOException {
  printTo((Appendable) out, instant);
}

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

/**
 * Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
 * using ISO chronology in the default DateTimeZone.
 *
 * @param buf  the destination to format to, not null
 * @param instant  millis since 1970-01-01T00:00:00Z
 */
public void printTo(StringBuilder buf, long instant) {
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
}

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

/**
 * 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 {
  printTo((Appendable) out, partial);
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param buf  the destination to format to, not null
 * @param instant  instant to format, null means now
 */
public void printTo(StringBuffer buf, ReadableInstant instant) {
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuffer does not throw IOException
  }
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param buf  the destination to format to, not null
 * @param instant  instant to format, null means now
 */
public void printTo(StringBuilder buf, ReadableInstant instant) {
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
}

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

/**
 * Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
 * using ISO chronology in the default DateTimeZone.
 *
 * @param appendable  the destination to format to, not null
 * @param instant  millis since 1970-01-01T00:00:00Z
 * @since 2.0
 */
public void printTo(Appendable appendable, long instant) throws IOException {
  printTo(appendable, instant, null);
}

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

/**
 * Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
 * using ISO chronology in the default DateTimeZone.
 *
 * @param buf  the destination to format to, not null
 * @param instant  millis since 1970-01-01T00:00:00Z
 */
public void printTo(StringBuffer buf, long instant) {
  try {
    printTo((Appendable) buf, instant);
  } catch (IOException ex) {
    // StringBuffer does not throw IOException
  }
}

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

/**
 * 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(StringBuilder buf, ReadablePartial partial) {
  try {
    printTo((Appendable) buf, partial);
  } catch (IOException ex) {
    // StringBuilder does not throw IOException
  }
}

代码示例来源:origin: prestodb/presto

@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
  long millis = type.getLong(block, position);
  buffer.setLength(0);
  dateTimeFormatter.printTo(buffer, millis);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}

代码示例来源:origin: prestodb/presto

private void encodeValue(Block block, int position, SliceOutput output)
{
  long days = type.getLong(block, position);
  long millis = TimeUnit.DAYS.toMillis(days);
  buffer.setLength(0);
  HIVE_DATE_PARSER.printTo(buffer, millis);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param appendable  the destination to format to, not null
 * @param instant  instant to format, null means now
 * @since 2.0
 */
public void printTo(Appendable appendable, ReadableInstant instant) throws IOException {
  long millis = DateTimeUtils.getInstantMillis(instant);
  Chronology chrono = DateTimeUtils.getInstantChronology(instant);
  printTo(appendable, millis, chrono);
}

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

/**
 * Prints a ReadableInstant, using the chronology supplied by the instant.
 *
 * @param appendable  the destination to format to, not null
 * @param instant  instant to format, null means now
 * @since 2.0
 */
public void printTo(Appendable appendable, ReadableInstant instant) throws IOException {
  long millis = DateTimeUtils.getInstantMillis(instant);
  Chronology chrono = DateTimeUtils.getInstantChronology(instant);
  printTo(appendable, millis, chrono);
}

代码示例来源:origin: prestodb/presto

@Override
public void encodeColumn(Block block, SliceOutput output, EncodeOutput encodeOutput)
{
  for (int position = 0; position < block.getPositionCount(); position++) {
    if (block.isNull(position)) {
      output.writeBytes(nullSequence);
    }
    else {
      long millis = type.getLong(block, position);
      buffer.setLength(0);
      dateTimeFormatter.printTo(buffer, millis);
      for (int index = 0; index < buffer.length(); index++) {
        output.writeByte(buffer.charAt(index));
      }
    }
    encodeOutput.closeEntry();
  }
}

相关文章