1 33 package com.internetcds.jdbc.tds; 34 35 import java.io.*; 36 37 38 51 class TdsAsciiInputStream extends java.io.InputStream 52 { 53 public static final String cvsVersion = "$Id: TdsAsciiInputStream.java,v 1.1 2006/06/23 10:39:30 sinisa Exp $"; 54 55 String data; 57 58 int next = 0; 60 61 public TdsAsciiInputStream(String data_) 62 { 63 data = data_; 64 next = 0; 65 } 66 67 68 public String getData() 69 { 70 return data; 71 } 72 73 74 public String toString() 75 { 76 return getData(); 77 } 78 79 80 public int read() 81 throws java.io.IOException 82 { 83 int result; 84 85 if (data == null) 86 { 87 throw new java.io.IOException ("stream was null"); 88 } 89 else if (next == data.length()) 90 { 91 result = -1; 92 } 93 else 94 { 95 result = data.charAt(next); 96 next++; 97 } 98 return result; 99 } 100 } 101 | Popular Tags |