1 29 30 package com.caucho.quercus.lib.file; 31 32 import com.caucho.quercus.env.StringBuilderValue; 33 import com.caucho.quercus.env.StringValue; 34 import com.caucho.quercus.resources.StreamResource; 35 import com.caucho.vfs.Path; 36 37 import java.io.IOException ; 38 import java.io.OutputStream ; 39 40 43 public class FileValue extends StreamResource { 44 private Path _path; 45 46 public FileValue(Path path) 47 { 48 _path = path; 49 } 50 51 54 public Path getPath() 55 { 56 return _path; 57 } 58 59 62 public int read() 63 throws IOException 64 { 65 return -1; 66 } 67 68 71 public StringValue readLine() 72 throws IOException 73 { 74 StringBuilderValue sb = new StringBuilderValue(); 75 76 int ch; 77 78 while ((ch = read()) >= 0) { 79 sb.append((char) ch); 80 81 if (ch == '\n') 82 return sb; 83 } 85 86 if (sb.length() > 0) 87 return sb; 88 else 89 return null; 90 } 91 92 99 public void writeToStream(OutputStream os, int length) 100 throws IOException 101 { 102 } 103 104 107 public void print(String v) 108 throws IOException 109 { 110 } 111 112 115 public void close() 116 { 117 } 118 119 123 public String toString() 124 { 125 return "File[" + _path + "]"; 126 } 127 } 128 129 | Popular Tags |