@Override public byte[] toByteArray() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Img.source(source).writeTo(baos, contentType); return baos.toByteArray(); } }
@Override public byte[] toByteArray() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Img.source(source).writeTo(baos, contentType); return baos.toByteArray(); } }
public void writeTo(String fileName) { writeTo(new File(fileName)); }
@Override public void apply(H.Request req, H.Response resp) { try { applyCookies(resp); applyHeaders(resp); resp.contentType(contentType); if (!resp.containsHeader(CONTENT_DISPOSITION)) { resp.contentDisposition(null, true); } applyStatus(resp); applyBeforeCommitHandler(req, resp); Img.source(img).writeTo(resp.outputStream(), contentType); } catch (Exception e) { throw E.unexpected(e); } finally { try { resp.commit(); applyAfterCommitHandler(req, resp); } finally { clearThreadLocals(); } } }
@Override public void apply(H.Request req, H.Response resp) { try { applyCookies(resp); applyHeaders(resp); resp.contentType(contentType); if (!resp.containsHeader(CONTENT_DISPOSITION)) { resp.contentDisposition(null, true); } applyStatus(resp); applyBeforeCommitHandler(req, resp); Img.source(img).writeTo(resp.outputStream(), contentType); } catch (Exception e) { throw E.unexpected(e); } finally { try { resp.commit(); applyAfterCommitHandler(req, resp); } finally { clearThreadLocals(); } } }
public void writeTo(File file) { writeTo(IO.outputStream(file), mimeType(file)); }
public void writeTo(File file, String mimeType) { writeTo(IO.outputStream(file), mimeType); }
public void writeTo(File file) { writeTo(IO.outputStream(file), mimeType(file)); }
public void writeTo(File file, String mimeType) { writeTo(IO.outputStream(file), mimeType); }
public void writeTo(String fileName) { writeTo(new File(fileName)); }
public byte[] toByteArray(String mimeType) { ByteArrayOutputStream baos = IO.baos(); writeTo(baos, mimeType(mimeType)); return baos.toByteArray(); }
@Override protected int doWriteTo(OutputStream sink) { Img.source(source).writeTo(sink, contentType); return -1; } }
@Override protected int doWriteTo(OutputStream sink) { Img.source(source).writeTo(sink, contentType); return -1; } }
public byte[] toByteArray(String mimeType) { ByteArrayOutputStream baos = IO.baos(); writeTo(baos, mimeType(mimeType)); return baos.toByteArray(); }