java/sql-dk/src/info/globalcode/sql/dk/batch/BatchDecoder.java
branchv_0
changeset 148 1b2f40cd432b
parent 146 4f4f515df807
equal deleted inserted replaced
147:4a704c1669f4 148:1b2f40cd432b
    36  */
    36  */
    37 public class BatchDecoder {
    37 public class BatchDecoder {
    38 
    38 
    39 	public Batch decode(InputStream in) throws BatchException {
    39 	public Batch decode(InputStream in) throws BatchException {
    40 		return new BatchFromStream(new DataInputStream(in));
    40 		return new BatchFromStream(new DataInputStream(in));
    41 
       
    42 	}
    41 	}
    43 
    42 
    44 	private class BatchFromStream implements Batch {
    43 	private class BatchFromStream implements Batch {
    45 
    44 
    46 		private DataInputStream in;
    45 		private DataInputStream in;
   102 					throw new BatchException("This is not SQL-DK batch: " + toHex(buffer));
   101 					throw new BatchException("This is not SQL-DK batch: " + toHex(buffer));
   103 				}
   102 				}
   104 			} catch (IOException e) {
   103 			} catch (IOException e) {
   105 				throw new BatchException("Unable to read batch header", e);
   104 				throw new BatchException("Unable to read batch header", e);
   106 			}
   105 			}
   107 
       
   108 		}
   106 		}
   109 	}
   107 	}
   110 }
   108 }