1 29 package org.jruby.util; 30 31 import java.io.EOFException ; 32 import java.io.IOException ; 33 import java.nio.channels.FileChannel ; 34 35 import org.jruby.Ruby; 36 37 public class IOHandlerNull extends IOHandler { 38 39 public IOHandlerNull(Ruby runtime, IOModes modes) { 40 super(runtime); 41 42 this.modes = modes; 43 } 44 45 public FileChannel getFileChannel() { 46 return null; 48 } 49 50 public ByteList gets(ByteList separatorString) throws IOException , BadDescriptorException, 51 EOFException { 52 throw new EOFException (); 53 } 54 55 public ByteList getsEntireStream() throws IOException , 56 BadDescriptorException, EOFException { 57 throw new EOFException (); 58 } 59 60 public ByteList read(int number) throws IOException , BadDescriptorException, 61 EOFException { 62 throw new EOFException (); 63 } 64 65 public int write(ByteList string) throws IOException , BadDescriptorException { 66 return string.length(); 67 } 68 69 public int getc() throws IOException , BadDescriptorException, EOFException { 70 throw new EOFException (); 71 } 72 73 public void ungetc(int c) { 74 } 75 76 public void putc(int c) throws IOException , BadDescriptorException { 77 } 78 79 public ByteList sysread(int number) throws IOException , BadDescriptorException, EOFException { 80 throw new EOFException (); 81 } 82 83 public int syswrite(ByteList buf) throws IOException , BadDescriptorException { 84 return buf.length(); 85 } 86 87 public int syswrite(int c) throws IOException , BadDescriptorException { 88 return 1; 89 } 90 91 public IOHandler cloneIOHandler() throws IOException , PipeException, InvalidValueException { 92 return new IOHandlerNull(getRuntime(), modes); 93 } 94 95 public void close() throws IOException , BadDescriptorException { 96 } 97 98 public void flush() throws IOException , BadDescriptorException { 99 } 100 101 public void sync() throws IOException , BadDescriptorException { 102 } 103 104 public boolean isEOF() throws IOException , BadDescriptorException { 105 return true; 106 } 107 108 public int pid() { 109 return 0; 110 } 111 112 public long pos() throws IOException , PipeException { 113 return 0; 114 } 115 116 protected void resetByModes(IOModes newModes) throws IOException , InvalidValueException { 117 } 118 119 public void rewind() throws IOException , PipeException, InvalidValueException { 120 } 121 122 public void seek(long offset, int type) throws IOException , PipeException, 123 InvalidValueException { 124 } 125 126 public void truncate(long newLength) throws IOException , PipeException { 127 } 128 } 129 | Popular Tags |