1958 * <ul> 1959 * <li>{@code uuuu-MM-dd'T'HH:mm}</li> 1960 * <li>{@code uuuu-MM-dd'T'HH:mm:ss}</li> 1961 * <li>{@code uuuu-MM-dd'T'HH:mm:ss.SSS}</li> 1962 * <li>{@code uuuu-MM-dd'T'HH:mm:ss.SSSSSS}</li> 1963 * <li>{@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSS}</li> 1964 * </ul> 1965 * The format used will be the shortest that outputs the full value of 1966 * the time where the omitted parts are implied to be zero. 1967 * 1968 * @return a string representation of this date-time, not null 1969 */ 1970 @Override 1971 public String toString() { 1972 return date.toString() + 'T' + time.toString(); 1973 } 1974 1975 //----------------------------------------------------------------------- 1976 /** 1977 * Writes the object using a 1978 * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>. 1979 * @serialData 1980 * <pre> 1981 * out.writeByte(5); // identifies a LocalDateTime 1982 * // the <a href="../../serialized-form.html#java.time.LocalDate">date</a> excluding the one byte header 1983 * // the <a href="../../serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header 1984 * </pre> 1985 * 1986 * @return the instance of {@code Ser}, not null 1987 */ 1988 private Object writeReplace() { 1989 return new Ser(Ser.LOCAL_DATE_TIME_TYPE, this); 1990 } 1991 1992 /** 1993 * Defend against malicious streams. 1994 * 1995 * @param s the stream to read 1996 * @throws InvalidObjectException always 1997 */ 1998 private void readObject(ObjectInputStream s) throws InvalidObjectException { 1999 throw new InvalidObjectException("Deserialization via serialization delegate"); 2000 } 2001 2002 void writeExternal(DataOutput out) throws IOException { 2003 date.writeExternal(out); | 1958 * <ul> 1959 * <li>{@code uuuu-MM-dd'T'HH:mm}</li> 1960 * <li>{@code uuuu-MM-dd'T'HH:mm:ss}</li> 1961 * <li>{@code uuuu-MM-dd'T'HH:mm:ss.SSS}</li> 1962 * <li>{@code uuuu-MM-dd'T'HH:mm:ss.SSSSSS}</li> 1963 * <li>{@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSS}</li> 1964 * </ul> 1965 * The format used will be the shortest that outputs the full value of 1966 * the time where the omitted parts are implied to be zero. 1967 * 1968 * @return a string representation of this date-time, not null 1969 */ 1970 @Override 1971 public String toString() { 1972 return date.toString() + 'T' + time.toString(); 1973 } 1974 1975 //----------------------------------------------------------------------- 1976 /** 1977 * Writes the object using a 1978 * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>. 1979 * @serialData 1980 * <pre> 1981 * out.writeByte(5); // identifies a LocalDateTime 1982 * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalDate">date</a> excluding the one byte header 1983 * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header 1984 * </pre> 1985 * 1986 * @return the instance of {@code Ser}, not null 1987 */ 1988 private Object writeReplace() { 1989 return new Ser(Ser.LOCAL_DATE_TIME_TYPE, this); 1990 } 1991 1992 /** 1993 * Defend against malicious streams. 1994 * 1995 * @param s the stream to read 1996 * @throws InvalidObjectException always 1997 */ 1998 private void readObject(ObjectInputStream s) throws InvalidObjectException { 1999 throw new InvalidObjectException("Deserialization via serialization delegate"); 2000 } 2001 2002 void writeExternal(DataOutput out) throws IOException { 2003 date.writeExternal(out); |