KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > quercus > resources > StreamResource


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.quercus.resources;
31
32 import com.caucho.quercus.env.ResourceValue;
33 import com.caucho.quercus.env.StringValue;
34
35 import java.io.IOException JavaDoc;
36
37 /**
38  * Represents a PHP open stream
39  */

40 public class StreamResource extends ResourceValue {
41   /**
42    * Reads the next byte, returning -1 on eof.
43    */

44   public int read()
45     throws IOException JavaDoc
46   {
47     return -1;
48   }
49   
50   /**
51    * Reads a buffer, returning -1 on eof.
52    */

53   public int read(byte []buffer, int offset, int length)
54     throws IOException JavaDoc
55   {
56     return -1;
57   }
58
59   /**
60    * Reads the optional linefeed character from a \r\n
61    */

62   public boolean readOptionalLinefeed()
63     throws IOException JavaDoc
64   {
65     return false;
66   }
67   
68   /**
69    * Reads a line from the buffer.
70    */

71   public StringValue readLine()
72     throws IOException JavaDoc
73   {
74     return null;
75   }
76   
77   /**
78    * Writes to a buffer.
79    */

80   public int write(byte []buffer, int offset, int length)
81     throws IOException JavaDoc
82   {
83     return -1;
84   }
85   
86   /**
87    * prints
88    */

89   public void print(char ch)
90     throws IOException JavaDoc
91   {
92     print(String.valueOf(ch));
93   }
94   
95   /**
96    * prints
97    */

98   public void print(String JavaDoc s)
99     throws IOException JavaDoc
100   {
101   }
102
103   /**
104    * Returns true on the end of file.
105    */

106   public boolean isEOF()
107   {
108     return true;
109   }
110
111   /**
112    * Flushes the output
113    */

114   public void flush()
115   {
116   }
117
118   /**
119    * Returns the current location in the file.
120    */

121   public long getPosition()
122   {
123     return 0;
124   }
125
126   /**
127    * Closes the stream.
128    */

129   public void close()
130   {
131   }
132
133   /**
134    * Closes the stream for reading
135    */

136   public void closeRead()
137   {
138   }
139
140   /**
141    * Closes the stream for writing
142    */

143   public void closeWrite()
144   {
145   }
146 }
147
148
Popular Tags