Java 类org.joda.time.format.DateTimeFormatterBuilder 实例源码
项目:alfresco-repository
文件:TikaPoweredMetadataExtracter.java
public TikaPoweredMetadataExtracter(String extractorContext, HashSet<String> supportedMimeTypes, HashSet<String> supportedEmbedMimeTypes)
{
super(supportedMimeTypes, supportedEmbedMimeTypes);
this.extractorContext = extractorContext;
// TODO Once TIKA-451 is fixed this list will get nicer
DateTimeParser[] parsersUTC = {
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").getParser(),
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ").getParser()
};
DateTimeParser[] parsers = {
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss").getParser(),
DateTimeFormat.forPattern("yyyy-MM-dd").getParser(),
DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").getParser(),
DateTimeFormat.forPattern("yyyy/MM/dd").getParser(),
DateTimeFormat.forPattern("EEE MMM dd hh:mm:ss zzz yyyy").getParser()
};
this.tikaUTCDateFormater = new DateTimeFormatterBuilder().append(null, parsersUTC).toFormatter().withZone(DateTimeZone.UTC);
this.tikaDateFormater = new DateTimeFormatterBuilder().append(null, parsers).toFormatter();
}
项目:eHMP
文件:HL7DateTimeFormat.java
public static DateTimeFormatter dateTime() {
if (hl7 == null) {
hl7 = new DateTimeFormatterBuilder()
.appendYear(4, 4)
.appendMonthOfYear(2)
.appendDayOfMonth(2)
.appendHourOfDay(2)
.appendMinuteOfHour(2)
.appendSecondOfMinute(2)
.appendLiteral('.')
.appendMillisOfSecond(3)
.appendTimeZoneOffset(null, false, 2, 2)
.toFormatter();
}
return hl7;
}
项目:eHMP
文件:HL7DateTimeFormat.java
public static DateTimeFormatter dateTime() {
if (hl7 == null) {
hl7 = new DateTimeFormatterBuilder()
.appendYear(4, 4)
.appendMonthOfYear(2)
.appendDayOfMonth(2)
.appendHourOfDay(2)
.appendMinuteOfHour(2)
.appendSecondOfMinute(2)
.appendLiteral('.')
.appendMillisOfSecond(3)
.appendTimeZoneOffset(null, false, 2, 2)
.toFormatter();
}
return hl7;
}
项目:grafikon
文件:TimeConverter.java
/**
* creates instance with specific rounding.
*
* @param rounding
* rounding
*/
public TimeConverter(Rounding rounding) {
this.rounding = rounding;
char separator = DecimalFormatSymbols.getInstance().getDecimalSeparator();
DateTimeFormatterBuilder parseBuilder = new DateTimeFormatterBuilder().appendHourOfDay(2).appendLiteral(':')
.appendMinuteOfHour(2);
parseBuilder.appendOptional(new DateTimeFormatterBuilder().appendLiteral(separator)
.appendFractionOfMinute(0, 1).toParser());
this.parse = parseBuilder.toFormatter();
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder().appendHourOfDay(1).appendLiteral(':')
.appendMinuteOfHour(2);
DateTimeFormatterBuilder builderFull = new DateTimeFormatterBuilder().appendHourOfDay(2).appendLiteral(':')
.appendMinuteOfHour(2);
if (rounding != Rounding.MINUTE) {
builder.appendLiteral(separator).appendFractionOfMinute(1, 1);
builderFull.appendLiteral(separator).appendFractionOfMinute(1, 1);
}
this.print = builder.toFormatter();
this.printFull = builderFull.toFormatter();
this.duration = new DecimalFormat("###.#");
this.printXml = ISODateTimeFormat.hourMinuteSecond();
}
项目:google-glass-share-barcode-bluetooth
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Crashlytics.start(this);
EventBus.getDefault().register(this);
connection = getConnection();
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
ButterKnife.inject(this, this);
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
formatter = builder.appendHourOfDay(2).appendLiteral(':')
.appendMinuteOfHour(2).appendLiteral(':')
.appendSecondOfMinute(2).toFormatter();
textView.setMovementMethod(new ScrollingMovementMethod());
textView.setTypeface(Typeface.MONOSPACE);
if (savedInstanceState == null) {
Intent intent = new Intent(this, BackServiceImpl.class);
startService(intent);
} else {
String logText = savedInstanceState.getString(LOG_EXTRA);
textView.setText(logText);
}
}
项目:community-edition-old
文件:TikaPoweredMetadataExtracter.java
public TikaPoweredMetadataExtracter(String extractorContext, HashSet<String> supportedMimeTypes, HashSet<String> supportedEmbedMimeTypes)
{
super(supportedMimeTypes, supportedEmbedMimeTypes);
this.extractorContext = extractorContext;
// TODO Once TIKA-451 is fixed this list will get nicer
DateTimeParser[] parsersUTC = {
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").getParser(),
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ").getParser()
};
DateTimeParser[] parsers = {
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss").getParser(),
DateTimeFormat.forPattern("yyyy-MM-dd").getParser(),
DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").getParser(),
DateTimeFormat.forPattern("yyyy/MM/dd").getParser(),
DateTimeFormat.forPattern("EEE MMM dd hh:mm:ss zzz yyyy").getParser()
};
this.tikaUTCDateFormater = new DateTimeFormatterBuilder().append(null, parsersUTC).toFormatter().withZone(DateTimeZone.UTC);
this.tikaDateFormater = new DateTimeFormatterBuilder().append(null, parsers).toFormatter();
}
项目:SolRDF
文件:FieldInjectorRegistry.java
@Override
protected DateTimeFormatter initialValue() {
return new DateTimeFormatterBuilder()
.append(DateTimeFormat.forPattern("yyyy-MM-dd"))
.appendOptional(
new DateTimeFormatterBuilder()
.appendLiteral('T')
.appendOptional(
new DateTimeFormatterBuilder()
.append(DateTimeFormat.forPattern("HH"))
.appendOptional(
new DateTimeFormatterBuilder()
.append(DateTimeFormat.forPattern(":mm"))
.appendOptional(
new DateTimeFormatterBuilder()
.append(DateTimeFormat.forPattern(":ss"))
.toParser())
.toParser())
.toParser())
.toParser())
.toFormatter();
}
项目:mvp-notes
文件:NoteDetailsDialogFragment.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
setData(getArguments());
}
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
mFormatter = builder
.appendYear(4, 4).appendLiteral("-")
.appendMonthOfYear(2).appendLiteral("-")
.appendDayOfMonth(2).appendLiteral(" at ")
.appendHourOfDay(2).appendLiteral(":")
.appendMinuteOfHour(2)
.toFormatter();
}
项目:SES
文件:ObjectPropertyValueParser.java
/**
*
* @return a formatter for common ISO strings
*/
private DateTimeFormatter buildDTFormatter() {
//build a parser for time stamps
return new DateTimeFormatterBuilder()
.appendYear(4, 4) //4 digit year (YYYY)
.appendLiteral("-")
.appendMonthOfYear(2) //2 digit month (MM)
.appendLiteral("-")
.appendDayOfMonth(2) //2 digit day (DD)
.appendLiteral("T")
.appendHourOfDay(2) //2 digit hour (hh)
.appendLiteral(":")
.appendMinuteOfHour(2) //2 digit minute (mm)
.appendLiteral(":")
.appendSecondOfMinute(2)//2 digit second (ss)
//optional 3 digit milliseconds of second
.appendOptional(new DateTimeFormatterBuilder()
.appendLiteral(".")
.appendMillisOfSecond(3)
.toParser())
//optional time zone offset as (+|-)hh:mm
.appendOptional(new DateTimeFormatterBuilder()
.appendTimeZoneOffset("", true, 2, 2)
.toParser())
.toFormatter();
}
项目:SES
文件:OWS8Parser.java
/**
*
* @return a formatter for common ISO strings
*/
private DateTimeFormatter buildDTFormatter() {
//build a parser for time stamps
return new DateTimeFormatterBuilder()
.appendYear(4, 4) //4 digit year (YYYY)
.appendLiteral("-")
.appendMonthOfYear(2) //2 digit month (MM)
.appendLiteral("-")
.appendDayOfMonth(2) //2 digit day (DD)
.appendLiteral("T")
.appendHourOfDay(2) //2 digit hour (hh)
.appendLiteral(":")
.appendMinuteOfHour(2) //2 digit minute (mm)
.appendLiteral(":")
.appendSecondOfMinute(2)//2 digit second (ss)
//optional 3 digit milliseconds of second
.appendOptional(new DateTimeFormatterBuilder()
.appendLiteral(".")
.appendMillisOfSecond(3)
.toParser())
//optional time zone offset as (+|-)hh:mm
.appendOptional(new DateTimeFormatterBuilder()
.appendTimeZoneOffset("", true, 2, 2)
.toParser())
.toFormatter();
}
项目:SES
文件:FaaSaaPilotParser.java
/**
*
* @return a formatter for common ISO strings
*/
private DateTimeFormatter buildDTFormatter() {
//build a parser for time stamps
return new DateTimeFormatterBuilder()
.appendYear(4, 4) //4 digit year (YYYY)
.appendLiteral("-")
.appendMonthOfYear(2) //2 digit month (MM)
.appendLiteral("-")
.appendDayOfMonth(2) //2 digit day (DD)
.appendLiteral("T")
.appendHourOfDay(2) //2 digit hour (hh)
.appendLiteral(":")
.appendMinuteOfHour(2) //2 digit minute (mm)
.appendLiteral(":")
.appendSecondOfMinute(2)//2 digit second (ss)
//optional 3 digit milliseconds of second
.appendOptional(new DateTimeFormatterBuilder()
.appendLiteral(".")
.appendMillisOfSecond(3)
.toParser())
//optional time zone offset as (+|-)hh:mm
.appendOptional(new DateTimeFormatterBuilder()
.appendTimeZoneOffset("", true, 2, 2)
.toParser())
.toFormatter();
}
项目:threadwatch
文件:HiResTimestamp.java
public String toUIString()
{
DateTimeFormatter DF = new DateTimeFormatterBuilder()
.appendYear(4, 4)
.appendLiteral('-')
.appendMonthOfYear(1)
.appendLiteral('-')
.appendDayOfMonth(1)
.appendLiteral(" ")
.appendHourOfDay(2)
.appendLiteral(':')
.appendMinuteOfHour(2)
.appendLiteral(':')
.appendSecondOfMinute(2)
.appendLiteral('.')
.appendMillisOfSecond(1)
.toFormatter();
return DF.print( toDateTime());
}
项目:threadwatch
文件:HiResInterval.java
public String toUIString()
{
DateTimeFormatter DF = new DateTimeFormatterBuilder()
.appendYear(4, 4)
.appendLiteral('-')
.appendMonthOfYear(1)
.appendLiteral('-')
.appendDayOfMonth(1)
.appendLiteral(" ")
.appendHourOfDay(2)
.appendLiteral(':')
.appendMinuteOfHour(2)
.appendLiteral(':')
.appendSecondOfMinute(2)
.appendLiteral('.')
.appendMillisOfSecond(1)
.toFormatter();
final String start = DF.print( this.start.toDateTime());
final String end = DF.print( this.end.toDateTime());
return start+" - "+end+" [ "+getDurationInMilliseconds()+" ms ]";
}
项目:elasticsearch_my
文件:Joda.java
public static FormatDateTimeFormatter getStrictStandardDateFormatter() {
// 2014/10/10
DateTimeFormatter shortFormatter = new DateTimeFormatterBuilder()
.appendFixedDecimal(DateTimeFieldType.year(), 4)
.appendLiteral('/')
.appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2)
.appendLiteral('/')
.appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2)
.toFormatter()
.withZoneUTC();
// 2014/10/10 12:12:12
DateTimeFormatter longFormatter = new DateTimeFormatterBuilder()
.appendFixedDecimal(DateTimeFieldType.year(), 4)
.appendLiteral('/')
.appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2)
.appendLiteral('/')
.appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2)
.appendLiteral(' ')
.appendFixedSignedDecimal(DateTimeFieldType.hourOfDay(), 2)
.appendLiteral(':')
.appendFixedSignedDecimal(DateTimeFieldType.minuteOfHour(), 2)
.appendLiteral(':')
.appendFixedSignedDecimal(DateTimeFieldType.secondOfMinute(), 2)
.toFormatter()
.withZoneUTC();
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder().append(longFormatter.withZone(DateTimeZone.UTC).getPrinter(), new DateTimeParser[]{longFormatter.getParser(), shortFormatter.getParser(), new EpochTimeParser(true)});
return new FormatDateTimeFormatter("yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis", builder.toFormatter().withZone(DateTimeZone.UTC), Locale.ROOT);
}
项目:elasticsearch_my
文件:SimpleJodaTests.java
public void testMultiParsers() {
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
DateTimeParser[] parsers = new DateTimeParser[3];
parsers[0] = DateTimeFormat.forPattern("MM/dd/yyyy").withZone(DateTimeZone.UTC).getParser();
parsers[1] = DateTimeFormat.forPattern("MM-dd-yyyy").withZone(DateTimeZone.UTC).getParser();
parsers[2] = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZone(DateTimeZone.UTC).getParser();
builder.append(DateTimeFormat.forPattern("MM/dd/yyyy").withZone(DateTimeZone.UTC).getPrinter(), parsers);
DateTimeFormatter formatter = builder.toFormatter();
formatter.parseMillis("2009-11-15 14:12:12");
}
项目:QDrill
文件:DateUtility.java
public static DateTimeFormatter getDateTimeFormatter() {
if (dateTimeTZFormat == null) {
DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yyyy-MM-dd");
DateTimeParser optionalTime = DateTimeFormat.forPattern(" HH:mm:ss").getParser();
DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
DateTimeParser optionalZone = DateTimeFormat.forPattern(" ZZZ").getParser();
dateTimeTZFormat = new DateTimeFormatterBuilder().append(dateFormatter).appendOptional(optionalTime).appendOptional(optionalSec).appendOptional(optionalZone).toFormatter();
}
return dateTimeTZFormat;
}
项目:QDrill
文件:DateUtility.java
public static DateTimeFormatter getTimeFormatter() {
if (timeFormat == null) {
DateTimeFormatter timeFormatter = DateTimeFormat.forPattern("HH:mm:ss");
DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
timeFormat = new DateTimeFormatterBuilder().append(timeFormatter).appendOptional(optionalSec).toFormatter();
}
return timeFormat;
}
项目:scribe
文件:CRMMessageFormatUtils.java
/**
*
* @param finishDate
* @return
* @throws Exception
*/
public static final DateTime validateInputDate(final String date, final String permittedDateFormats) throws Exception {
logger.debug("----Inside validateInputDate, date: " + date + " & permittedDateFormats: " + permittedDateFormats);
/* Seperate all the formats */
final String[] defaultDateFormats = permittedDateFormats.split(",");
/* Create array for all date parsing formats */
final DateTimeParser[] dateTimeParser = new DateTimeParser[defaultDateFormats.length];
/* Parse with individual formats */
for (int i = 0; i < defaultDateFormats.length; i++) {
/* If format is valid */
if (defaultDateFormats[i] != null && !"".equals(defaultDateFormats[i])) {
/* Create new parser for each format */
dateTimeParser[i] = DateTimeFormat.forPattern(defaultDateFormats[i].trim()).getParser();
}
}
/* Final date formater builder */
final DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder().append(null, dateTimeParser).toFormatter();
/* Parse user supplied date */
final DateTime updatedDate = dateTimeFormatter.parseDateTime(date);
logger.debug("----Inside validateInputDate, updated date: " + updatedDate);
/* Return updated date */
return updatedDate;
}
项目:drill
文件:DateUtility.java
public static DateTimeFormatter getDateTimeFormatter() {
if (dateTimeTZFormat == null) {
DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yyyy-MM-dd");
DateTimeParser optionalTime = DateTimeFormat.forPattern(" HH:mm:ss").getParser();
DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
DateTimeParser optionalZone = DateTimeFormat.forPattern(" ZZZ").getParser();
dateTimeTZFormat = new DateTimeFormatterBuilder().append(dateFormatter).appendOptional(optionalTime).appendOptional(optionalSec).appendOptional(optionalZone).toFormatter();
}
return dateTimeTZFormat;
}
项目:drill
文件:DateUtility.java
public static DateTimeFormatter getTimeFormatter() {
if (timeFormat == null) {
DateTimeFormatter timeFormatter = DateTimeFormat.forPattern("HH:mm:ss");
DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
timeFormat = new DateTimeFormatterBuilder().append(timeFormatter).appendOptional(optionalSec).toFormatter();
}
return timeFormat;
}
项目:TinyTravelTracker
文件:DateTimeZone.java
/**
* Gets a printer/parser for managing the offset id formatting.
*
* @return the formatter
*/
private static synchronized DateTimeFormatter offsetFormatter() {
if (cOffsetFormatter == null) {
cOffsetFormatter = new DateTimeFormatterBuilder()
.appendTimeZoneOffset(null, true, 2, 4)
.toFormatter();
}
return cOffsetFormatter;
}
项目:sakai
文件:CalendarUtil.java
static String getLocalAMString(DateTime now) {
//we need an AM date
DateTime dt = now.withTimeAtStartOfDay();
Locale locale= new ResourceLoader("calendar").getLocale();
DateTimeFormatter df = new DateTimeFormatterBuilder().appendHalfdayOfDayText().toFormatter().withLocale(locale);
return df.print(dt);
}
项目:sakai
文件:CalendarUtil.java
static String getLocalPMString(DateTime now) {
//we need an PM date
DateTime dt = now.withTimeAtStartOfDay().plusHours(14);
Locale locale = new ResourceLoader("calendar").getLocale();
DateTimeFormatter df = new DateTimeFormatterBuilder().appendHalfdayOfDayText().toFormatter().withLocale(locale);
return df.print(dt);
}
项目:https-github.com-h2oai-h2o-3
文件:ParseTime.java
public static String listTimezones() {
DateTimeFormatter offsetFormatter = new DateTimeFormatterBuilder().appendTimeZoneOffset(null, true, 2, 4).toFormatter();
Set<String> idSet = DateTimeZone.getAvailableIDs();
Map<String, String> tzMap = new TreeMap();
Iterator<String> it = idSet.iterator();
String id, cid, offset, key, output;
DateTimeZone tz;
int i = 0;
long millis = System.currentTimeMillis();
// collect canonical and alias IDs into a map
while (it.hasNext()) {
id = it.next();
tz = DateTimeZone.forID(id);
cid = tz.getID();
offset = offsetFormatter.withZone(tz).print(tz.getStandardOffset(millis));
key = offset + " " + cid;
if (id == cid) { // Canonical ID
if (!tzMap.containsKey(key)) tzMap.put(key, "");
} else {// alias ID
if (!tzMap.containsKey(key))
tzMap.put(key, "");
tzMap.put(key, tzMap.get(key) + ", " + id);
}
}
// assemble result
output = "StandardOffset CanonicalID, Aliases\n";
for (Map.Entry<String, String> e : tzMap.entrySet())
output += e.getKey() + e.getValue()+"\n";
return output;
}
项目:eHMP
文件:HL7DateTimeFormat.java
public static PointInTimeFormatter pointInTimeParser() {
if (ptp == null) {
DateTimeFormatter f = new DateTimeFormatterBuilder()
.appendYear(4, 4)
.appendOptional(twoDigitNumber(DateTimeFieldType.monthOfYear()))
.appendOptional(twoDigitNumber(DateTimeFieldType.dayOfMonth()))
.appendOptional(twoDigitNumber(DateTimeFieldType.hourOfDay()))
.appendOptional(twoDigitNumber(DateTimeFieldType.minuteOfHour()))
.appendOptional(twoDigitNumber(DateTimeFieldType.secondOfMinute()))
.appendOptional(dotMilliseconds())
.toFormatter();
ptp = new PointInTimeFormatter(f.getPrinter(), f.getParser());
}
return ptp;
}
项目:eHMP
文件:VPRDateTimeFormat.java
public static DateTimeFormatter date() {
if (d == null) {
d = new DateTimeFormatterBuilder()
.append(year())
.append(monthOfYear())
.append(dayOfMonth())
.toFormatter();
}
return d;
}
项目:eHMP
文件:VPRDateTimeFormat.java
public static PointInTimeFormatter pointInTimeParser() {
if (ptp == null) {
DateTimeFormatter f = new DateTimeFormatterBuilder()
.append(date())
.toFormatter();
ptp = new PointInTimeFormatter(f.getPrinter(), f.getParser());
}
return ptp;
}
项目:eHMP
文件:RFC822DateTimeFormat.java
public static DateTimeFormatter dateTime() {
if (dt == null) {
dt = new DateTimeFormatterBuilder()
.appendPattern("dd MMM yyyy hh:mm:ss")
// .appendLiteral(' ')
// .appendTimeZoneOffset("", false, 2, 2)
.toFormatter();
}
return dt;
}
项目:eHMP
文件:HL7DateTimeFormat.java
public static PointInTimeFormatter pointInTimeParser() {
if (ptp == null) {
DateTimeFormatter f = new DateTimeFormatterBuilder()
.appendYear(4, 4)
.appendOptional(twoDigitNumber(DateTimeFieldType.monthOfYear()))
.appendOptional(twoDigitNumber(DateTimeFieldType.dayOfMonth()))
.appendOptional(twoDigitNumber(DateTimeFieldType.hourOfDay()))
.appendOptional(twoDigitNumber(DateTimeFieldType.minuteOfHour()))
.appendOptional(twoDigitNumber(DateTimeFieldType.secondOfMinute()))
.appendOptional(dotMilliseconds())
.toFormatter();
ptp = new PointInTimeFormatter(f.getPrinter(), f.getParser());
}
return ptp;
}
项目:JECommons
文件:DataSourceHelper.java
private static List<String> getMatchingPathes(String path, String[] pathStream, ArrayList<String> arrayList, FTPClient fc, DateTime lastReadout, DateTimeFormatterBuilder dtfbuilder) {
int nextTokenPos = getPathTokens(path).length;
if (nextTokenPos == pathStream.length - 1) {
arrayList.add(path);
return arrayList;
}
String nextToken = pathStream[nextTokenPos];
String nextFolder = null;
try {
if (containsDateToken(nextToken)) {
FTPFile[] listDirectories = fc.listFiles(path);
// DateTimeFormatter ftmTemp = getDateFormatter(nextToken);
for (FTPFile folder : listDirectories) {
if (!matchDateString(folder.getName(), nextToken)) {
continue;
}
// System.out.println("listdir," + folder.getName());
// if (containsDate(folder.getName(), ftmTemp)) {
DateTime folderTime = getFolderTime(path + folder.getName() + "/", pathStream);
if (folderTime.isAfter(lastReadout)) {
nextFolder = folder.getName();
// System.out.println("dateFolder," + nextFolder);
getMatchingPathes(path + nextFolder + "/", pathStream, arrayList, fc, lastReadout, dtfbuilder);
}
// }
}
} else {
nextFolder = nextToken;
// System.out.println("normalFolder," + nextFolder);
getMatchingPathes(path + nextFolder + "/", pathStream, arrayList, fc, lastReadout, dtfbuilder);
}
} catch (IOException ex) {
org.apache.log4j.Logger.getLogger(DataSourceHelper.class).log(org.apache.log4j.Level.ERROR, ex.getMessage());
}
return arrayList;
}
项目:JECommons
文件:DataSourceHelper.java
private static List<String> getSFTPMatchingPathes(String path, String[] pathStream, ArrayList<String> arrayList, ChannelSftp fc, DateTime lastReadout, DateTimeFormatterBuilder dtfbuilder) {
int nextTokenPos = getPathTokens(path).length;
if (nextTokenPos == pathStream.length - 1) {
arrayList.add(path);
return arrayList;
}
String nextToken = pathStream[nextTokenPos];
String nextFolder = null;
try {
if (containsDateToken(nextToken)) {
Vector listDirectories = fc.ls(path);
for (Object folder : listDirectories) {
LsEntry currentFolder = (LsEntry) folder;
if (!matchDateString(currentFolder.getFilename(), nextToken)) {
continue;
}
DateTime folderTime = getFolderTime(path + currentFolder.getFilename() + "/", pathStream);
if (folderTime.isAfter(lastReadout)) {
nextFolder = currentFolder.getFilename();
getSFTPMatchingPathes(path + nextFolder + "/", pathStream, arrayList, fc, lastReadout, dtfbuilder);
}
// }
}
} else {
nextFolder = nextToken;
getSFTPMatchingPathes(path + nextFolder + "/", pathStream, arrayList, fc, lastReadout, dtfbuilder);
}
} catch (SftpException ex) {
org.apache.log4j.Logger.getLogger(DataSourceHelper.class).log(org.apache.log4j.Level.ERROR, "Cant find suitable files on the device");
}
return arrayList;
}
项目:astor
文件:DateTimeZone.java
/**
* Gets a printer/parser for managing the offset id formatting.
*
* @return the formatter
*/
private static synchronized DateTimeFormatter offsetFormatter() {
if (cOffsetFormatter == null) {
cOffsetFormatter = new DateTimeFormatterBuilder()
.appendTimeZoneOffset(null, true, 2, 4)
.toFormatter();
}
return cOffsetFormatter;
}
项目:astor
文件:DateTimeZone.java
/**
* Gets a printer/parser for managing the offset id formatting.
*
* @return the formatter
*/
private static synchronized DateTimeFormatter offsetFormatter() {
if (cOffsetFormatter == null) {
cOffsetFormatter = new DateTimeFormatterBuilder()
.appendTimeZoneOffset(null, true, 2, 4)
.toFormatter();
}
return cOffsetFormatter;
}
项目:togg
文件:DateTimeFormatter.java
public static String hhMMAMPM(Date date) {
org.joda.time.format.DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.appendClockhourOfHalfday(1).appendLiteral(":")
.appendMinuteOfHour(2).appendLiteral(" ")
.appendHalfdayOfDayText().toFormatter();
if (date != null) {
return formatter.print(date.getTime());
} else {
return "";
}
}
项目:togg
文件:DateTimeFormatter.java
public static String onlyDate(Date date) {
org.joda.time.format.DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.appendDayOfMonth(2).appendLiteral("/").appendMonthOfYear(2)
.appendLiteral("/").appendYear(2, 4).toFormatter();
return formatter.print(date.getTime());
}
项目:togg
文件:DateTimeFormatter.java
public static String literalDate(Date date) {
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder()
.appendDayOfWeekShortText().appendLiteral(" ")
.appendDayOfMonth(1).appendLiteral(". ")
.appendMonthOfYearShortText();
if (date.getYear() != new Date().getYear()) {
builder.appendLiteral(" ").appendYear(2, 4);
}
org.joda.time.format.DateTimeFormatter formatter = builder
.toFormatter();
return formatter.print(date.getTime());
}
项目:togg
文件:DateTimeFormatter.java
public static String hhMM(Date date) {
org.joda.time.format.DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.appendClockhourOfHalfday(2).appendLiteral(":")
.appendMinuteOfHour(2).appendLiteral(" ").toFormatter();
return formatter.print(date.getTime());
}
项目:Finanvita
文件:PeriodHelper.java
public static String getPeriodTitle(Context context, int type, long start, long end) {
final String result;
switch (type) {
case TYPE_DAY:
result = DateUtils.formatDateTime(context, start, 0);
break;
case TYPE_WEEK:
result = DateUtils.formatDateRange(context, start, end, 0);
break;
case TYPE_MONTH:
final DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
builder.appendMonthOfYearText();
if (new DateTime(System.currentTimeMillis()).year().get() != new DateTime(start).year().get())
builder.appendLiteral(' ').appendYear(4, 4);
result = builder.toFormatter().print(start);
break;
case TYPE_YEAR:
final Calendar c = Calendar.getInstance();
c.setTimeInMillis(start);
result = String.valueOf(c.get(Calendar.YEAR));
break;
default:
result = "?";
break;
}
return result;
}
项目:h2o-3
文件:ParseTime.java
public static String listTimezones() {
DateTimeFormatter offsetFormatter = new DateTimeFormatterBuilder().appendTimeZoneOffset(null, true, 2, 4).toFormatter();
Set<String> idSet = DateTimeZone.getAvailableIDs();
Map<String, String> tzMap = new TreeMap();
Iterator<String> it = idSet.iterator();
String id, cid, offset, key, output;
DateTimeZone tz;
int i = 0;
long millis = System.currentTimeMillis();
// collect canonical and alias IDs into a map
while (it.hasNext()) {
id = it.next();
tz = DateTimeZone.forID(id);
cid = tz.getID();
offset = offsetFormatter.withZone(tz).print(tz.getStandardOffset(millis));
key = offset + " " + cid;
if (id == cid) { // Canonical ID
if (!tzMap.containsKey(key)) tzMap.put(key, "");
} else {// alias ID
if (!tzMap.containsKey(key))
tzMap.put(key, "");
tzMap.put(key, tzMap.get(key) + ", " + id);
}
}
// assemble result
output = "StandardOffset CanonicalID, Aliases\n";
for (Map.Entry<String, String> e : tzMap.entrySet())
output += e.getKey() + e.getValue()+"\n";
return output;
}
项目:BikeMan
文件:MillisecondPrecisionSyslogStartConverter.java
public void start() {
int errorCount = 0;
final String facilityStr = getFirstOption();
if (facilityStr == null) {
addError("was expecting a facility string as an option");
return;
}
facility = SyslogAppenderBase.facilityStringToint(facilityStr);
localHostName = getLocalHostname();
try {
isoFormatter = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd'T'HH:mm:ss.SSS")
.appendTimeZoneOffset("Z", true, 2, 4)
.toFormatter();
} catch (Exception e) {
addError("Could not instantiate Joda DateTimeFormatter", e);
errorCount++;
}
if (errorCount == 0) {
super.start();
}
}