Java Doc for Resource.java in  » Inversion-of-Control » JICE » org » jicengine » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Inversion of Control » JICE » org.jicengine.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.jicengine.io.Resource

All known Subclasses:   org.jicengine.io.AbstractResource,
Resource
public interface Resource (Code)

Provides a common interface for reading resources and resolving relative path-references.

A resource is typically a file that contains data to be used by an application. Java provides various ways for reading resources: java.io.File, java.net.URL, java.lang.Class.getResourceAsStream(), java.lang.ClassLoader.getResourceAsStream(), etc.

This class encapsulates all these under a common interface.

Copyright (C) 2004 Timo Laitinen


author:
   .timo
version:
   1.0




Method Summary
public  StringgetIdentifier()
    

Returns the identifier of this resource.

Depending on the kind of resource, the identifier could be a file-path, url, etc.

The identifier is descriptive - it will help a human to find out what kind of resource is in question.

public  InputStreamgetInputStream()
     A primary way reading the resource.
public  StringgetMimeType()
    

Returns the http mime-type of this Resource, if this Resource has one.

Mime-type information is an easy way to find out something about the type of content in a Resource.

public  ReadergetReader()
     Alternative way for reading text-based resources.
public  ResourcegetResource(String relativePath)
    

Locates another Resource whose path is defined relative to this Resource.

the path scheme used with files and urls is used for specifying relative paths.

the method generally returns instances of the same Resource-subclass than the current instance, but this is not obligatory.

NOTE:

NOTE: there is no support for absolute paths.

public  booleanisAvailable()
    

Tests whether the resource is available i.e.

public  voidwriteTo(OutputStream out)
     Writes the content of this resource into an OutputStream.
public  voidwriteTo(Writer writer)
    

Writes the content of this resource into a Writer.




Method Detail
getIdentifier
public String getIdentifier()(Code)

Returns the identifier of this resource.

Depending on the kind of resource, the identifier could be a file-path, url, etc.

The identifier is descriptive - it will help a human to find out what kind of resource is in question. It CAN NOT be used for creating new Resources or for reading resources. the format of the identifier varies and may be changed in the future.




getInputStream
public InputStream getInputStream() throws IOException(Code)
A primary way reading the resource. InputStream
throws:
  IOException - if the reading fails - if the resource doesn't exist,for example.



getMimeType
public String getMimeType()(Code)

Returns the http mime-type of this Resource, if this Resource has one.

Mime-type information is an easy way to find out something about the type of content in a Resource. it also makes it easier to write Resource data into http-responses.

NOTE: this property is optional! null is returned if the mime-typeinformation is not available. and most in cases it probably isn't.



getReader
public Reader getReader() throws IOException(Code)
Alternative way for reading text-based resources. A Reader that returns data from this Resource.
throws:
  IOException - if the reading fails - if the resource doesn't exist,for example.



getResource
public Resource getResource(String relativePath) throws IOException(Code)

Locates another Resource whose path is defined relative to this Resource.

the path scheme used with files and urls is used for specifying relative paths.

the method generally returns instances of the same Resource-subclass than the current instance, but this is not obligatory.

NOTE:

NOTE: there is no support for absolute paths. yet.


Parameters:
  relativePath - name of the neighbouring resource. only relative pathsare allowed, don't put the root mark '/' in the beginning. notationslike '../' can be used (in most of the cases, at least) Windows-likepaths '\joku\jotain.txt' won't work. a new Resource. The returned Resource is most likely ofthe same type as this resource (although there's no guarantee). Inother words, if this Resource is a FileResource, the returned Resourcewill also be a FileResource.NOTE: this method doesn't necessary check the availability of the relativeresource, because that may be too slow. if you want to make sure that thereturned resource is available, you must examine the availability of thereturned resource by your self.
throws:
  IOException - if a reference to the neighbouring resource couldn't becreated.



isAvailable
public boolean isAvailable()(Code)

Tests whether the resource is available i.e. can be read.

If this method returns true, the attempt to read this Resource (with getInputStream() or other methods) is not likely to fail. Unless the resource is somehow removed between the two method calls.

If a false is return, the resource is not available.

NOTE: testing whether a resource is available can be as resource-intensive as actually reading the resource.




writeTo
public void writeTo(OutputStream out) throws IOException(Code)
Writes the content of this resource into an OutputStream. This is an alternative way for obtaining the data of this Resource.
throws:
  IOException - if the content of this Resource isn't available - ifthe resource doesn't exist, for example.



writeTo
public void writeTo(Writer writer) throws IOException(Code)

Writes the content of this resource into a Writer. This is an alternative way for obtaining the data of this Resource.


throws:
  IOException - if the content of this Resource isn't available - ifthe resource doesn't exist, for example.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.