1 24 25 package com.mckoi.database.jdbc; 26 27 import java.io.InputStream ; 28 import java.io.IOException ; 29 import java.io.BufferedReader ; 30 import java.io.Reader ; 31 32 40 41 final class UnicodeToBinaryStream extends InputStream { 42 43 46 private Reader reader; 47 48 52 private int lr_byte; 53 54 57 private int current_c; 58 59 62 public UnicodeToBinaryStream(Reader reader) { 63 this.reader = new BufferedReader (reader); 67 lr_byte = 0; 68 } 69 70 73 public int read() throws IOException { 74 if (lr_byte == 0) { 75 current_c = reader.read(); 76 if (current_c == -1) { 77 return -1; 78 } 79 lr_byte = 1; 80 return (current_c >> 8) & 0x0FF; 81 } 82 else { 83 lr_byte = 0; 84 return current_c & 0x0FF; 85 } 86 } 87 88 public int available() throws IOException { 89 return 0; 90 } 91 92 } 93 94 | Popular Tags |