@@ -40,7 +40,7 @@ following listing provides an overview of the `Resource` interface. See the
4040{api-spring-framework}/core/io/Resource.html[`Resource`] javadoc for further details.
4141
4242
43- [source,java,indent=0,subs="verbatim,quotes",role="primary" ]
43+ [source,java,indent=0,subs="verbatim,quotes"]
4444.Java
4545----
4646 public interface Resource extends InputStreamSource {
@@ -70,67 +70,21 @@ following listing provides an overview of the `Resource` interface. See the
7070 String getFilename();
7171
7272 String getDescription();
73-
74- }
75- ----
76- [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
77- .Kotlin
78- ----
79- interface Resource : InputStreamSource {
80-
81- fun exists(): Boolean
82-
83- fun isReadable(): Boolean
84-
85- fun isOpen(): Boolean
86-
87- fun isFile(): Boolean
88-
89- fun getURL(): URL
90-
91- @Throws(IOException::class)
92- fun getURI(): URI
93-
94- val file: File
95-
96- @Throws(IOException::class)
97- fun readableChannel(): ReadableByteChannel
98-
99- @Throws(IOException::class)
100- fun contentLength(): long
101-
102- @Throws(IOException::class)
103- fun lastModified(): long
104-
105- @Throws(IOException::class)
106- fun createRelative(relativePath: String): Resource
107-
108- val filename: String
109-
110- val description: String
11173 }
11274----
11375
11476As the definition of the `Resource` interface shows, it extends the `InputStreamSource`
11577interface. The following listing shows the definition of the `InputStreamSource`
11678interface:
11779
118- [source,java,indent=0,subs="verbatim,quotes",role="primary" ]
80+ [source,java,indent=0,subs="verbatim,quotes"]
11981.Java
12082----
12183 public interface InputStreamSource {
12284
12385 InputStream getInputStream() throws IOException;
12486 }
12587----
126- [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
127- .Kotlin
128- ----
129- interface InputStreamSource {
130-
131- val inputStream: InputStream
132- }
133- ----
13488
13589Some of the most important methods from the `Resource` interface are:
13690
@@ -303,7 +257,7 @@ The `ResourceLoader` interface is meant to be implemented by objects that can re
303257(that is, load) `Resource` instances. The following listing shows the `ResourceLoader`
304258interface definition:
305259
306- [source,java,indent=0,subs="verbatim,quotes",role="primary" ]
260+ [source,java,indent=0,subs="verbatim,quotes"]
307261.Java
308262----
309263 public interface ResourceLoader {
@@ -313,16 +267,6 @@ interface definition:
313267 ClassLoader getClassLoader();
314268 }
315269----
316- [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
317- .Kotlin
318- ----
319- interface ResourceLoader {
320-
321- fun getResource(location: String): Resource
322-
323- fun getClassLoader(): ClassLoader
324- }
325- ----
326270
327271All application contexts implement the `ResourceLoader` interface. Therefore, all
328272application contexts may be used to obtain `Resource` instances.
@@ -426,28 +370,14 @@ The `ResourcePatternResolver` interface is an extension to the `ResourceLoader`
426370which defines a strategy for resolving a location pattern (for example, an Ant-style path
427371pattern) into `Resource` objects.
428372
429- [source,java,indent=0,subs="verbatim,quotes",role="primary" ]
373+ [source,java,indent=0,subs="verbatim,quotes"]
430374.Java
431375----
432376 public interface ResourcePatternResolver extends ResourceLoader {
433377
434378 String CLASSPATH_ALL_URL_PREFIX = "classpath*:";
435379
436380 Resource[] getResources(String locationPattern) throws IOException;
437-
438- }
439- ----
440- [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
441- .Kotlin
442- ----
443- interface ResourcePatternResolver: ResourceLoader {
444-
445- @JvmField
446- val CLASSPATH_ALL_URL_PREFIX: String = "classpath*:"
447-
448- @Throws(IOException::class)
449- fun getResources(locationPattern: String): Resource[]
450-
451381 }
452382----
453383
@@ -492,22 +422,14 @@ The `ResourceLoaderAware` interface is a special callback interface which identi
492422components that expect to be provided a `ResourceLoader` reference. The following listing
493423shows the definition of the `ResourceLoaderAware` interface:
494424
495- [source,java,indent=0,subs="verbatim,quotes",role="primary" ]
425+ [source,java,indent=0,subs="verbatim,quotes"]
496426.Java
497427----
498428 public interface ResourceLoaderAware {
499429
500430 void setResourceLoader(ResourceLoader resourceLoader);
501431 }
502432----
503- [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
504- .Kotlin
505- ----
506- interface ResourceLoaderAware {
507-
508- fun setResourceLoader(resourceLoader: ResourceLoader)
509- }
510- ----
511433
512434When a class implements `ResourceLoaderAware` and is deployed into an application context
513435(as a Spring-managed bean), it is recognized as `ResourceLoaderAware` by the application
0 commit comments