001 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
002 // for details. All rights reserved. Use of this source code is governed by a
003 // BSD-style license that can be found in the LICENSE file.
004
005 package com.google.dart.compiler;
006
007 import java.io.IOException;
008 import java.io.Reader;
009 import java.net.URI;
010 import java.util.Date;
011
012 /**
013 * Abstract interface to a source file.
014 */
015 public interface Source {
016
017 /**
018 * Determines whether the given source exists.
019 */
020 boolean exists();
021
022 /**
023 * Returns the last-modified timestamp for this source, using the same units as
024 * {@link Date#getTime()}.
025 */
026 long getLastModified();
027
028 /**
029 * Gets the name of this source.
030 */
031 String getName();
032
033 /**
034 * Gets a reader for the dart file's source code. The caller is responsible for closing the
035 * returned reader.
036 */
037 Reader getSourceReader() throws IOException;
038
039 /**
040 * Gets the identifier for this source. This is used to uniquely identify the
041 * source, but should not be used to obtain the source content. Use
042 * {@link #getSourceReader()} to obtain the source content.
043 */
044 URI getUri();
045 }