@Override public byte[] asByteArray() throws UnexpectedIOException { return sobj.asByteArray(); }
@Override public H.Response writeBinary(ISObject binary) { byte[] ba = binary.asByteArray(); ByteBuffer buffer = ByteBuffer.allocateDirect(ba.length); buffer.put(ba); buffer.flip(); this.buffer = buffer; realResponse.writeContent(buffer); this.wroteDirectly = true; return this; }
@Override public H.Response writeBinary(ISObject binary) { byte[] ba = binary.asByteArray(); ByteBuffer buffer = ByteBuffer.allocateDirect(ba.length); buffer.put(ba); buffer.flip(); this.buffer = buffer; realResponse.writeContent(buffer); this.wroteDirectly = true; return this; }
@Override public byte[] asByteArray() throws UnexpectedIOException { return force().asByteArray(); }
@Override public byte[] asByteArray() throws UnexpectedIOException { return force().asByteArray(); }
@Override public byte[] asByteArray() throws UnexpectedIOException { return buf().asByteArray(); }
public static SObject valueOf(String key, ISObject copy) { SObject sobj = of(key, copy.asByteArray()); sobj.setAttrs(copy.getAttributes()); return sobj; }
public static SObject valueOf(String key, ISObject copy) { SObject sobj = of(key, copy.asByteArray()); sobj.setAttrs(copy.getAttributes()); return sobj; }
@Override public UndertowResponse writeBinary(ISObject binary) { beforeWritingContent(); File file = tryGetFileFrom(binary); if (null != file) { return send(file); } byte[] ba = binary.asByteArray(); ByteBuffer buffer = ByteBuffer.wrap(ba); sender().send(buffer); endAsync = !blocking(); afterWritingContent(); return this; }
@Override public UndertowResponse writeBinary(ISObject binary) { beforeWritingContent(); File file = tryGetFileFrom(binary); if (null != file) { return send(file); } byte[] ba = binary.asByteArray(); ByteBuffer buffer = ByteBuffer.wrap(ba); sender().send(buffer); endAsync = !blocking(); afterWritingContent(); return this; }
@Override public void put(String key, ISObject stuff) throws UnexpectedIOException { GridFS gfs = gfs(); gfs.remove(new BasicDBObject("name", key)); GridFSInputFile inputFile = gfs.createFile(stuff.asByteArray()); inputFile.setContentType(stuff.getAttribute(Blob.CONTENT_TYPE)); inputFile.put("name", key); inputFile.put("filename", stuff.getAttribute(Blob.FILENAME)); inputFile.save(); }