167 decodeAtom(ps, bStream, bytesPerAtom());
168 totalBytes += bytesPerAtom();
169 } else {
170 decodeAtom(ps, bStream, length - i);
171 totalBytes += (length - i);
172 }
173 decodeLineSuffix(ps, bStream);
174 } catch (CEStreamExhausted e) {
175 break;
176 }
177 }
178 decodeBufferSuffix(ps, bStream);
179 }
180
181 /**
182 * Alternate decode interface that takes a String containing the encoded
183 * buffer and returns a byte array containing the data.
184 * @exception CEFormatException An error has occurred while decoding
185 */
186 public byte[] decodeBuffer(String inputString) throws IOException {
187 byte inputBuffer[] = inputString.getBytes();
188 ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
189 ByteArrayOutputStream outStream = new ByteArrayOutputStream();
190 decodeBuffer(inStream, outStream);
191 return outStream.toByteArray();
192 }
193
194 /**
195 * Decode the contents of the inputstream into a buffer.
196 */
197 public byte[] decodeBuffer(InputStream in) throws IOException {
198 ByteArrayOutputStream outStream = new ByteArrayOutputStream();
199 decodeBuffer(in, outStream);
200 return outStream.toByteArray();
201 }
202
203 /**
204 * Decode the contents of the String into a ByteBuffer.
205 */
206 public ByteBuffer decodeBufferToByteBuffer(String inputString)
207 throws IOException {
|
167 decodeAtom(ps, bStream, bytesPerAtom());
168 totalBytes += bytesPerAtom();
169 } else {
170 decodeAtom(ps, bStream, length - i);
171 totalBytes += (length - i);
172 }
173 decodeLineSuffix(ps, bStream);
174 } catch (CEStreamExhausted e) {
175 break;
176 }
177 }
178 decodeBufferSuffix(ps, bStream);
179 }
180
181 /**
182 * Alternate decode interface that takes a String containing the encoded
183 * buffer and returns a byte array containing the data.
184 * @exception CEFormatException An error has occurred while decoding
185 */
186 public byte[] decodeBuffer(String inputString) throws IOException {
187 byte inputBuffer[] = inputString.getBytes("8859_1");
188 ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
189 ByteArrayOutputStream outStream = new ByteArrayOutputStream();
190 decodeBuffer(inStream, outStream);
191 return outStream.toByteArray();
192 }
193
194 /**
195 * Decode the contents of the inputstream into a buffer.
196 */
197 public byte[] decodeBuffer(InputStream in) throws IOException {
198 ByteArrayOutputStream outStream = new ByteArrayOutputStream();
199 decodeBuffer(in, outStream);
200 return outStream.toByteArray();
201 }
202
203 /**
204 * Decode the contents of the String into a ByteBuffer.
205 */
206 public ByteBuffer decodeBufferToByteBuffer(String inputString)
207 throws IOException {
|