public void upload()

in src/main/java/com/microsoft/azure/datalake/store/Utils.java [82:100]


    public void upload(String filename, byte[] contents, IfExists mode) throws IOException  {
        if (filename == null || filename.trim().equals(""))
            throw new IllegalArgumentException("filename cannot be null");

        if (contents.length <= 4 * 1024 * 1024) { // if less than 4MB, then do a direct CREATE in a single operation
            boolean overwrite = (mode==IfExists.OVERWRITE);
            RequestOptions opts = new RequestOptions();
            opts.retryPolicy = overwrite ? client.makeExponentialBackoffPolicy() : new NonIdempotentRetryPolicy();
            OperationResponse resp = new OperationResponse();
            Core.create(filename, overwrite, null, contents, 0, contents.length, null, null, true, SyncFlag.CLOSE, client, opts, resp);
            if (!resp.successful) {
                throw client.getExceptionFromResponse(resp, "Error creating file " + filename);
            }
        } else {
            try (ByteArrayInputStream bis = new ByteArrayInputStream(contents)){
                upload(filename, bis, mode);
            }
        }
    }