Package com.fasterxml.storemate.shared

Examples of com.fasterxml.storemate.shared.ByteContainer


        StorableCreationResult result;
        StorableCreationMetadata stdMetadata = new StorableCreationMetadata(header.compression,
                header.checksum, header.checksumForCompressed);
        stdMetadata.uncompressedSize = header.size;
        stdMetadata.storageSize = header.storageSize;
        ByteContainer customMetadata = _entryConverter.createMetadata(_timeMaster.currentTimeMillis(),
                header.lastAccessMethod, header.minTTLSecs, header.maxTTLSecs);

        // although not 100% required, we can simplify handling of smallest entries
        if (expSize <= _stuff.getServiceConfig().storeConfig.maxInlinedStorageSize) { // inlineable
            ByteContainer data;

            if (expSize == 0) {
                data = ByteContainer.emptyContainer();
            } else {
                byte[] bytes = new byte[(int) expSize];
View Full Code Here


        {
            _content = content;
            _keyConverter = keyConverter;
            // Let's see if we can calculate content checksum early, for even the first request
            int checksum = 0;
            ByteContainer bytes = _content.contentAsBytes();
            if (bytes != null) {
                checksum = _keyConverter.contentHashFor(bytes);
            }
            _checksum = new AtomicInteger(checksum);
        }
View Full Code Here

       
        @Override
        public Body createBody() throws IOException
        {
            int checksum = _checksum.get();
            ByteContainer bytes = _content.contentAsBytes();
            if (bytes != null) {
                if (checksum == 0) {
                    checksum = _keyConverter.contentHashFor(bytes);
                    _checksum.set(checksum);
                }
                return bytes.withBytes(BodyCallback.instance);
            }
            File f = _content.contentAsFile();
            if (f != null) {
                try {
                    return new BodyFileBacked(f, _content.length(), _checksum);
View Full Code Here

        OutputStream out = null;
        HttpURLConnection conn;
        int hash = content.getContentHash();

        try {
            ByteContainer bc = content.contentAsBytes();
            if (bc != null) { // most efficient, yay
                if (hash == HashConstants.NO_CHECKSUM) {
                    hash = _keyConverter.contentHashFor(bc);
                    content.setContentHash(hash);
                }
                path = addChecksum(path, hash);
                URL url = path.asURL();
                conn = (HttpURLConnection) url.openConnection();
                conn.setDoOutput(true);
                conn.setFixedLengthStreamingMode(bc.byteLength());
                conn = initRequest("PUT", conn, path, timeoutMsecs);
                out = conn.getOutputStream();
                bc.writeBytes(out);
            } else {
                InputStream in; // closed in copy()
                File f = content.contentAsFile();
                // !!! TODO: add wrapper for calculating hash sum, if not yet calculated
                if (f != null) {
View Full Code Here

        OutputStream out = null;
        HttpURLConnection conn;
        int hash = content.getContentHash();

        try {
            ByteContainer bc = content.contentAsBytes();
            if (bc != null) { // most efficient, yay
                if (hash == HashConstants.NO_CHECKSUM) {
                    hash = _keyConverter.contentHashFor(bc);
                    content.setContentHash(hash);
                }
                path = addChecksum(path, hash);
                URL url = path.asURL();
                conn = (HttpURLConnection) url.openConnection();
                conn.setDoOutput(true);
                conn.setFixedLengthStreamingMode(bc.byteLength());
                conn.setRequestMethod("PUT");
                out = conn.getOutputStream();
                bc.writeBytes(out);
            } else {
                InputStream in; // closed in copy()
                File f = content.contentAsFile();
                // !!! TODO: add wrapper for calculating hash sum, if not yet calculated
                if (f != null) {
View Full Code Here

        StorableCreationResult result;
        StorableCreationMetadata stdMetadata = new StorableCreationMetadata(header.compression,
                header.checksum, header.checksumForCompressed);
        stdMetadata.uncompressedSize = header.size;
        stdMetadata.storageSize = header.storageSize;
        ByteContainer customMetadata = _entryConverter.createMetadata(_timeMaster.currentTimeMillis(),
                header.lastAccessMethod, header.minTTLSecs, header.maxTTLSecs);

        // although not 100% required, we can simplify handling of smallest entries
        if (expSize <= _stuff.getServiceConfig().storeConfig.maxInlinedStorageSize) { // inlineable
            ByteContainer data;

            if (expSize == 0) {
                data = ByteContainer.emptyContainer();
            } else {
                byte[] bytes = new byte[(int) expSize];
View Full Code Here

        OutputStream out = null;
        HttpURLConnection conn;
        int hash = content.getContentHash();

        try {
            ByteContainer bc = content.contentAsBytes();
            if (bc != null) { // most efficient, yay
                if (hash == HashConstants.NO_CHECKSUM) {
                    hash = _keyConverter.contentHashFor(bc);
                    content.setContentHash(hash);
                }
                path = addChecksum(path, hash);
                URL url = path.asURL();
                conn = (HttpURLConnection) url.openConnection();
                conn.setDoOutput(true);
                conn.setFixedLengthStreamingMode(bc.byteLength());
                conn = initRequest("PUT", conn, path, timeoutMsecs);
                out = conn.getOutputStream();
                bc.writeBytes(out);
            } else {
                InputStream in; // closed in copy()
                File f = content.contentAsFile();
                // !!! TODO: add wrapper for calculating hash sum, if not yet calculated
                if (f != null) {
View Full Code Here

        OutputStream out = null;
        HttpURLConnection conn;
        int hash = content.getContentHash();

        try {
            ByteContainer bc = content.contentAsBytes();
            if (bc != null) { // most efficient, yay
                if (hash == HashConstants.NO_CHECKSUM) {
                    hash = _keyConverter.contentHashFor(bc);
                    content.setContentHash(hash);
                }
                path = addChecksum(path, hash);
                URL url = path.asURL();
                conn = (HttpURLConnection) url.openConnection();
                conn.setDoOutput(true);
                conn.setFixedLengthStreamingMode(bc.byteLength());
                conn.setRequestMethod("PUT");
                out = conn.getOutputStream();
                bc.writeBytes(out);
            } else {
                InputStream in; // closed in copy()
                File f = content.contentAsFile();
                // !!! TODO: add wrapper for calculating hash sum, if not yet calculated
                if (f != null) {
View Full Code Here

        OutputStream out = null;
        HttpURLConnection conn;
        int hash = content.getContentHash();

        try {
            ByteContainer bc = content.contentAsBytes();
            if (bc != null) { // most efficient, yay
                if (hash == HashConstants.NO_CHECKSUM) {
                    hash = _keyConverter.contentHashFor(bc);
                    content.setContentHash(hash);
                }
                path = addChecksum(path, hash);
                URL url = path.asURL();
                conn = (HttpURLConnection) url.openConnection();
                conn.setDoOutput(true);
                conn.setFixedLengthStreamingMode(bc.byteLength());
                conn = initRequest("PUT", conn, path, timeoutMsecs);
                out = conn.getOutputStream();
                bc.writeBytes(out);
            } else {
                InputStream in; // closed in copy()
                File f = content.contentAsFile();
                // !!! TODO: add wrapper for calculating hash sum, if not yet calculated
                if (f != null) {
View Full Code Here

        StorableCreationResult result;
        StorableCreationMetadata stdMetadata = new StorableCreationMetadata(header.compression,
                header.checksum, header.checksumForCompressed);
        stdMetadata.uncompressedSize = header.size;
        stdMetadata.storageSize = header.storageSize;
        ByteContainer customMetadata = _entryConverter.createMetadata(_timeMaster.currentTimeMillis(),
                header.lastAccessMethod, header.minTTLSecs, header.maxTTLSecs);

        // although not 100% required, we can simplify handling of smallest entries
        if (expSize <= _stuff.getServiceConfig().storeConfig.maxInlinedStorageSize) { // inlineable
            ByteContainer data;

            if (expSize == 0) {
                data = ByteContainer.emptyContainer();
            } else {
                byte[] bytes = new byte[(int) expSize];
View Full Code Here

TOP

Related Classes of com.fasterxml.storemate.shared.ByteContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.