else if (payload instanceof String) {
try {
bytes = ((String) payload).getBytes(this.charset);
}
catch (UnsupportedEncodingException e) {
throw new MessageHandlingException(message, e);
}
}
else {
throw new MessageHandlingException(message,
"HdfsTextFileWriter expects " +
"either a byte array or String payload, but received: " + payload.getClass());
}
return bytes;
}