StringPart p = new StringPart(pair.getName(),pair.getValue());
out.write(p.toString().getBytes());
} else if (o instanceof FileParameter) {
FileParameter fp = (FileParameter)o;
pair = fp.getNameValuePair();
if (pair == null || pair.getName() == null || pair.getValue() == null) {
nullParameterWarning(pair);
continue;
}
File f = new File(pair.getValue());
if (f == null) {
LOG.warn(Messages.getString("SocketDataSource.8")+pair.getValue()); //$NON-NLS-1$
continue;
}
byte[] b = new byte[1024];
//send the file
FileInputStream fin = new FileInputStream(f);
while(fin.available() > 0) {
fin.read(b);
out.write(b);
}
} else if (o instanceof FileDataItem) {
FileDataItem fp = (FileDataItem)o;
pair = fp.getNameValuePair();
if (pair == null || pair.getName() == null || pair.getValue() == null) {
nullParameterWarning(pair);
continue;
}
File f = new File(pair.getValue());
if (f == null){
LOG.warn(Messages.getString("SocketDataSource.9")+pair.getValue()); //$NON-NLS-1$
continue;
}
//send the file
byte[] b = new byte[1024];
//send the file
FileInputStream fin = new FileInputStream(f);
while(fin.available() > 0) {
fin.read(b);
out.write(b);
}
} else if (o instanceof DataItem) {
DataItem fp = (DataItem)o;
pair = fp.getNameValuePair();
if (pair == null || pair.getName() == null || pair.getValue() == null) {
nullParameterWarning(pair);
continue;
}