mulesoft/raml-jaxrs-codegen — pull request #24 by justin-calleja (2014-07-30 16:29:00+00:00)
Title: POST with MimeType of 'application/octet-stream' should generate a parameter of type InputStream (which reads byte[]) not Reader (which reads char[])

I am trying to write an application with RAML and the Reader parameter generated when the MimeType is 'application/octet-stream' is not reading the correct number of bytes when uploading a binary file. I have used InputStream instead and the correct number are read (equal to the actual size of the file).

That lead me to think that, at least for 'application/octet-stream' there should be an InputStream parameter not a Reader which is generated. I think an InputStream should be the default "fallback" type returned by org.raml.jaxrs.codegen.core.Types.getRequestEntityClass(MimeType) line 110. Currently, it's:

// fallback to a generic reader
return getGeneratorType(Reader.class);

But I only changed it for the case when the MimeType is 'application/octet-stream' as I am not experienced enough to make that decision. It might break other people's apps. I currently think InputStream should be the default. Correct me if I'm wrong.