/** * Find out whether the URL exists . * @return true if this resource exists. */ public synchronized boolean isExists() { if (isReference()) { return getCheckedRef().isExists(); } return isExists(false); }
/** * Get the size of this Resource. * @return the size, as a long, 0 if the Resource does not exist (for * compatibility with java.io.File), or UNKNOWN_SIZE if not known. */ public synchronized long getSize() { if (isReference()) { return getCheckedRef().getSize(); } if (!isExists(false)) { return 0L; } return withConnection(c -> conn.getContentLength(), UNKNOWN_SIZE); }
/** * Tells the modification time in milliseconds since 01.01.1970 . * * @return 0 if the resource does not exist to mirror the behavior * of {@link java.io.File File}. */ public synchronized long getLastModified() { if (isReference()) { return getCheckedRef().getLastModified(); } if (!isExists(false)) { return UNKNOWN_DATETIME; } return withConnection(c -> conn.getLastModified(), UNKNOWN_DATETIME); }