ninja-core/src/main/java/ninja/Result.java
public Result renderRaw(final byte [] bytes) {
 
        Renderable renderable = new Renderable() {
                    
            @Override
            public void render(Context context, Result result) {
                if (result.getContentType() == null) {
                    result.contentType(Result.APPLICATION_OCTET_STREAM);
                }
                ResponseStreams responseStreams = context
                        .finalizeHeaders(result);
                
                try (OutputStream outputStream = responseStreams.getOutputStream()) {

                    outputStream.write(bytes);
                    
                } catch (IOException ioException) {
                    throw new InternalServerErrorException(ioException);
                }
            }
        };
                    
        render(renderable);
 
        return this;

   }
public Result renderRaw(final byte [] bytes) {
 
        Renderable renderable = new Renderable() {
                    
            @Override
            public void render(Context context, Result result) {
                if (result.getContentType() == null) {
                    result.contentType(Result.APPLICATION_OCTET_STREAM);
                }
                ResponseStreams responseStreams = context
                        .finalizeHeaders(result);
                
                try (OutputStream outputStream = responseStreams.getOutputStream()) {

                    outputStream.write(bytes);
                    
                } catch (IOException ioException) {
                    throw new InternalServerErrorException(ioException);
                }
            }
        };
                    
        render(renderable);
 
        return this;

   }
public Result renderRaw ( final byte [ ] bytes ) { Renderable renderable = new Renderable ( ) { @ Override public void render ( Context context , Result result ) { if ( result . getContentType ( ) == null ) { result . contentType ( Result . APPLICATION_OCTET_STREAM ) ; } ResponseStreams responseStreams = context . finalizeHeaders ( result ) ; try ( OutputStream outputStream = responseStreams . getOutputStream ( ) ) { outputStream . write ( bytes ) ; } catch ( IOException ioException ) { throw new InternalServerErrorException ( ioException ) ; } } } ; render ( renderable ) ; return this ; }
This method directly renders the byte array to the output. It
completely bypasses any rendering engine.

Thus you can render anything you want.

Chaining of resultRaw().resultRaw()... is NOT supported. Mixing with render()
is NOT supported.

It is always recommended to implement your own RenderingEngine OR
use existing rendering engines.

@param bytes The bytes to render.
@return A result that will render the string directly to the output stream.
This method directly renders the byte array to the output . It completely bypasses any rendering engine .