Package io.fathom.cloud.protobuf.FileModel

Examples of io.fathom.cloud.protobuf.FileModel.FileData


    private static int findFile(DirectoryDataOrBuilder dir, String key) {
        int foundIndex = -1;

        for (int i = 0; i < dir.getFilesCount(); i++) {
            FileData file = dir.getFiles(i);
            if (key.equals(file.getKey())) {
                foundIndex = i;
                break;
            }
        }
        return foundIndex;
View Full Code Here


        int foundIndex = findFile(dir, name);
        if (foundIndex == -1) {
            return null;
        }

        FileData found = dir.getFiles(foundIndex);
        return new FsFile(bucket, found);
    }
View Full Code Here

        DirectoryData.Builder newDir = DirectoryData.newBuilder(dir);

        FileData.Builder file = null;

        FileData oldFileData;

        int foundIndex = findFile(newDir, name);
        if (foundIndex != -1) {
            oldFileData = dir.getFiles(foundIndex);
            file = newDir.getFilesBuilder(foundIndex);
View Full Code Here

        DirectoryData.Builder newDir = DirectoryData.newBuilder(dir);

        FileData.Builder builder = null;

        FileData oldFileData;

        int foundIndex = findFile(newDir, name);
        if (foundIndex != -1) {
            oldFileData = dir.getFiles(foundIndex);
            builder = newDir.getFilesBuilder(foundIndex);
View Full Code Here

                // writeComma();
                // writeKeyLiteral("content_type");
                // writeValue("application/directory");
            } else {
                FileData file = entry.getFile();

                writeKeyLiteral("name");
                writeValue(file.getKey());

                if (file.hasHash()) {
                    writeComma();
                    writeKeyLiteral("hash");
                    writeValue(Hex.toHex(file.getHash().toByteArray()));
                }

                if (file.hasLength()) {
                    writeComma();
                    writeKeyLiteral("bytes");
                    writeValue(Long.toString(file.getLength()));
                }

                if (file.hasContentType()) {
                    writeComma();
                    writeKeyLiteral("content_type");
                    writeValue(file.getContentType());
                }

                if (file.hasLastModified()) {
                    writeComma();
                    writeKeyLiteral("last_modified");
                    writeValue(formatter.print(file.getLastModified()));
                }
            }
            endObject();
        }
View Full Code Here

        FsFile found = findFile();
        return buildReadResponse(httpRequest, fs, found);
    }

    private static void setHeaders(FsFile found, ResponseBuilder response) {
        FileData data = found.getData();

        if (data.hasLastModified()) {
            response.lastModified(new Date(data.getLastModified()));
        }

        if (data.hasHash()) {
            response.header(HttpHeaders.ETAG, Hex.toHex(data.getHash().toByteArray()));
        }

        if (data.hasContentType()) {
            response.header(HttpHeaders.CONTENT_TYPE, data.getContentType());
        }

        if (data.hasAttributes()) {
            Attributes attributes = data.getAttributes();
            for (KeyValueData entry : attributes.getUserAttributesList()) {
                response.header(OBJECT_META_PREFIX + entry.getKey(), entry.getValue());
            }
        }
    }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.protobuf.FileModel.FileData

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.