Hi,
It appears that the Zip/Unzip routines are stripping the CR/LF characters from the data. Would anyone know what I would need to modify to perserve the CR/LF characters in the data ??
IDataCursor idcPipeline = pipeline.getCursor();
String inString = IDataUtil.getString( idcPipeline, "inString" );
String inFile = IDataUtil.getString( idcPipeline, "inFile" );
idcPipeline.destroy();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ZipOutputStream zos = new ZipOutputStream(baos);
ZipEntry ze= new ZipEntry(inFile);
zos.putNextEntry(ze);
zos.write(inString.getBytes());
zos.close();
IDataUtil.put( idcPipeline, "result", baos.toByteArray());
}
catch (IOException e) {
IDataUtil.put( idcPipeline, "errorMessage", e.toString());
}
idcPipeline.destroy();
IDataCursor idcPipeline = pipeline.getCursor();
Object inputBytes = IDataUtil.get( idcPipeline, "inData" );
idcPipeline.destroy();
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream((byte[]) inputBytes));
ZipEntry ze = null;
try {
while ((ze = zis.getNextEntry()) != null) {
//The Assumption being there will be only one file in this zip.
InputStreamReader is = new InputStreamReader(zis);
StringBuilder sb=new StringBuilder();
BufferedReader br = new BufferedReader(is);
String fName = ze.getName();
String read = br.readLine();
while(read != null) {
sb.append(read);
read = br.readLine();
}
IDataUtil.put(idcPipeline, "outFileName", fName.toString());
IDataUtil.put(idcPipeline, "outString", sb.toString());
}
}
catch (FileNotFoundException e) {
IDataUtil.put( idcPipeline, "errorMessage", e.toString());
}
catch (IOException e) {
IDataUtil.put( idcPipeline, "errorMessage", e.toString());
}
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods