1 /******************************************************************************* 2 * Copyright (c) 2015 LegSem. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the GNU Lesser Public License v2.1 5 * which accompanies this distribution, and is available at 6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 7 * 8 * Contributors: 9 * LegSem - initial API and implementation 10 ******************************************************************************/ 11 package com.legstar.coxb.transform; 12 13 import java.io.Writer; 14 15 /** 16 * Host to JSON transformers offer the capability to turn a raw mainframe byte 17 * array to JSON. 18 * 19 */ 20 public interface IHostToJsonTransformer { 21 22 /** 23 * Transforms host data to JSON with a specific host character set. 24 * 25 * @param hostData a byte array containing host data 26 * @param writer JSON will be sent to this writer. 27 * @param hostCharset the host character set 28 * @throws HostTransformException if transformation fails 29 */ 30 void transform( 31 final byte[] hostData, 32 final Writer writer, 33 final String hostCharset) throws HostTransformException; 34 35 /** 36 * Transforms host data to JSON with a specific host character set. 37 * 38 * @param hostData a byte array containing host data 39 * @param offset index of first byte to process in hostData 40 * @param writer JSON will be sent to this writer. 41 * @param hostCharset the host character set 42 * @throws HostTransformException if transformation fails 43 */ 44 void transform( 45 final byte[] hostData, 46 final int offset, 47 final Writer writer, 48 final String hostCharset) throws HostTransformException; 49 50 /** 51 * Transforms host data to JSON. 52 * 53 * @param hostData a byte array containing host data 54 * @param writer JSON will be sent to this writer. 55 * @throws HostTransformException if transformation fails 56 */ 57 void transform( 58 final byte[] hostData, 59 final Writer writer) throws HostTransformException; 60 61 /** 62 * Transforms host data to JSON. 63 * 64 * @param hostData a byte array containing host data 65 * @param offset index of first byte to process in hostData 66 * @param writer JSON will be sent to this writer. 67 * @throws HostTransformException if transformation fails 68 */ 69 void transform( 70 final byte[] hostData, 71 final int offset, 72 final Writer writer) throws HostTransformException; 73 74 /** 75 * Transforms host data to JSON with a specific host character set. 76 * 77 * @param hostData a byte array containing host data 78 * @param writer JSON will be sent to this writer. 79 * @param hostCharset the host character set 80 * @param status will contain information on the transformation after it is 81 * executed 82 * @throws HostTransformException if transformation fails 83 */ 84 void transform( 85 final byte[] hostData, 86 final Writer writer, 87 final String hostCharset, 88 final HostTransformStatus status) throws HostTransformException; 89 90 /** 91 * Transforms host data to JSON with a specific host character set. 92 * 93 * @param hostData a byte array containing host data 94 * @param offset index of first byte to process in hostData 95 * @param writer JSON will be sent to this writer. 96 * @param hostCharset the host character set 97 * @param status will contain information on the transformation after it is 98 * executed 99 * @throws HostTransformException if transformation fails 100 */ 101 void transform( 102 final byte[] hostData, 103 final int offset, 104 final Writer writer, 105 final String hostCharset, 106 final HostTransformStatus status) throws HostTransformException; 107 108 /** 109 * Transforms host data to JSON. 110 * 111 * @param hostData a byte array containing host data 112 * @param writer JSON will be sent to this writer. 113 * @param status will contain information on the transformation after it is 114 * executed 115 * @throws HostTransformException if transformation fails 116 */ 117 void transform( 118 final byte[] hostData, 119 final Writer writer, 120 final HostTransformStatus status) throws HostTransformException; 121 122 /** 123 * Transforms host data to JSON. 124 * 125 * @param hostData a byte array containing host data 126 * @param offset index of first byte to process in hostData 127 * @param writer JSON will be sent to this writer. 128 * @param status will contain information on the transformation after it is 129 * executed 130 * @throws HostTransformException if transformation fails 131 */ 132 void transform( 133 final byte[] hostData, 134 final int offset, 135 final Writer writer, 136 final HostTransformStatus status) throws HostTransformException; 137 }