Code example for ByteArrayBuffer

0
 
    @Override 
    public void startedPart(Map<String, String> headers) {
 
        if (document == null) {
           jsonBuffer = new ByteArrayBuffer(1024);
        } 
        else { 
            curAttachment = database.getAttachmentWriter();
 
            String contentDisposition = headers.get("Content-Disposition");
            if (contentDisposition != null && contentDisposition.startsWith("attachment; filename=")) {
                // TODO: Parse this less simplistically. Right now it assumes it's in exactly the same 
                // format generated by -[CBL_Pusher uploadMultipartRevision:]. CouchDB (as of 1.2) doesn't 
                // output any headers at all on attachments so there's no compatibility issue yet. 
 
                String contentDispositionUnquoted = CBLMisc.unquoteString(contentDisposition);
                String name = contentDispositionUnquoted.substring(21);
 
                if (name != null) {
                    attachmentsByName.put(name, curAttachment);