@@ -33,9 +33,11 @@ such as a method to check for the existence of the resource being pointed to.
33
33
[[resources-resource]]
34
34
== The Resource Interface
35
35
36
- Spring's `Resource` interface is meant to be a more capable interface for abstracting
37
- access to low-level resources. The following listing shows the `Resource` interface
38
- definition:
36
+ Spring's `Resource` interface located in the `org.springframework.core.io.` package is
37
+ meant to be a more capable interface for abstracting access to low-level resources. The
38
+ following listing provides an overview of the `Resource` interface. See the
39
+ {api-spring-framework}/core/io/Resource.html[`Resource`] javadoc for further details.
40
+
39
41
40
42
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
41
43
.Java
@@ -44,17 +46,30 @@ definition:
44
46
45
47
boolean exists();
46
48
49
+ boolean isReadable();
50
+
47
51
boolean isOpen();
48
52
53
+ boolean isFile();
54
+
49
55
URL getURL() throws IOException;
50
56
57
+ URI getURI() throws IOException;
58
+
51
59
File getFile() throws IOException;
52
60
61
+ ReadableByteChannel readableChannel() throws IOException;
62
+
63
+ long contentLength() throws IOException;
64
+
65
+ long lastModified() throws IOException;
66
+
53
67
Resource createRelative(String relativePath) throws IOException;
54
68
55
69
String getFilename();
56
70
57
71
String getDescription();
72
+
58
73
}
59
74
----
60
75
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
@@ -64,12 +79,28 @@ definition:
64
79
65
80
fun exists(): Boolean
66
81
67
- val isOpen: Boolean
82
+ fun isReadable(): Boolean
83
+
84
+ fun isOpen(): Boolean
68
85
69
- val url: URL
86
+ fun isFile(): Boolean
87
+
88
+ fun getURL(): URL
89
+
90
+ @Throws(IOException::class)
91
+ fun getURI(): URI
70
92
71
93
val file: File
72
94
95
+ @Throws(IOException::class)
96
+ fun readableChannel(): ReadableByteChannel
97
+
98
+ @Throws(IOException::class)
99
+ fun contentLength(): long
100
+
101
+ @Throws(IOException::class)
102
+ fun lastModified(): long
103
+
73
104
@Throws(IOException::class)
74
105
fun createRelative(relativePath: String): Resource
75
106
0 commit comments