1 21 22 package org.apache.derby.impl.jdbc; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import java.io.InputStream ; 27 import java.io.IOException ; 28 import java.io.EOFException ; 29 30 35 final class BinaryToRawStream 36 extends java.io.FilterInputStream 37 { 38 42 private int length; 43 44 private Object parent; 47 48 BinaryToRawStream(InputStream in, Object parent) 49 throws IOException 50 { 51 super(in); 52 53 this.parent = parent; 54 55 int bl = in.read(); 56 if (bl == -1) 57 throw new java.io.EOFException (); 58 59 if ((bl & 0x80) != 0) 60 { 61 if (bl == 0xC0) 62 { 63 int v1 = in.read(); 64 int v2 = in.read(); 65 int v3 = in.read(); 66 int v4 = in.read(); 67 68 if (v1 == -1 || v2 == -1 || v3 == -1 || v4 == -1) 69 throw new java.io.EOFException (); 70 length = (((v1 & 0xff) << 24) | 71 ((v2 & 0xff) << 16) | 72 ((v3 & 0xff) << 8) | 73 (v4 & 0xff)); 74 75 } 76 else if (bl == 0xA0) 77 { 78 int v1 = in.read(); 80 int v2 = in.read(); 81 if (v1 == -1 || v2 == -1) 82 throw new java.io.EOFException (); 83 length = (((v1 & 0xff) << 8) + (v2 & 0xff)); 84 85 } 86 else 87 { 88 length = bl & 0x1F; 89 } 90 } 91 else 92 { 93 int v2 = in.read(); 95 int v3 = in.read(); 96 int v4 = in.read(); 97 if (v2 == -1 || v3 == -1 || v4 == -1) 98 throw new java.io.EOFException (); 99 int lenInBits = (((bl & 0xff) << 24) | ((v2 & 0xff) << 16) | ((v3 & 0xff) << 8) | (v4 & 0xff)); 100 101 length = lenInBits / 8; 102 if ((lenInBits % 8) != 0) 103 length++; 104 105 if (length == 0) 107 length = -1; 108 } 109 } 110 111 115 int getLength() 116 { 117 return length; 118 } 119 } 120 | Popular Tags |