Package org.locationtech.geogig.storage.text

Examples of org.locationtech.geogig.storage.text.TextSerializationFactory


        }
        ObjectId id = ObjectId.valueOf(lines.get(0).split("\t")[1].trim());
        String commitString = Joiner.on("\n").join(lines.subList(1, lines.size()));
        ByteArrayInputStream stream = new ByteArrayInputStream(
                commitString.getBytes(Charsets.UTF_8));
        ObjectReader<RevCommit> reader = new TextSerializationFactory().createCommitReader();
        RevCommit revCommit = reader.read(id, stream);
        return revCommit;

    }
View Full Code Here


    @Override
    protected CharSequence _call() {
        Preconditions.checkState(object != null);
        RevObject revObject = object.get();

        TextSerializationFactory factory = new TextSerializationFactory();
        ObjectWriter<RevObject> writer = factory.createObjectWriter(revObject.getType());
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        String s = "id\t" + revObject.getId().toString() + "\n";
        OutputStreamWriter streamWriter = new OutputStreamWriter(output, Charsets.UTF_8);
        try {
            streamWriter.write(s);
View Full Code Here

     * serialize the patch, use the {@link PatchSerializer} class instead. Use this method to show
     * patch content in a human-readable format
     */
    @Override
    public String toString() {
        TextSerializationFactory factory = new TextSerializationFactory();
        StringBuilder sb = new StringBuilder();
        for (FeatureInfo feature : addedFeatures) {
            String path = feature.getPath();
            sb.append("A\t" + path + "\t" + feature.getFeatureType().getId() + "\n");
            ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE);
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            RevFeature revFeature = RevFeatureBuilder.build(feature.getFeature());
            try {
                writer.write(revFeature, output);
            } catch (IOException e) {
            }
            sb.append(output.toString());
            sb.append('\n');
        }
        for (FeatureInfo feature : removedFeatures) {
            String path = feature.getPath();
            sb.append("R\t" + path + "\t" + feature.getFeatureType().getId() + "\n");
            ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE);
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            RevFeature revFeature = RevFeatureBuilder.build(feature.getFeature());
            try {
                writer.write(revFeature, output);
            } catch (IOException e) {
View Full Code Here

            writer.write(featureType, output);
            sb.append(output.toString());
            sb.append('\n');
        }

        TextSerializationFactory factory = new TextSerializationFactory();
        for (FeatureInfo feature : patch.getAddedFeatures()) {
            String path = feature.getPath();
            sb.append("A\t" + path + "\t" + feature.getFeatureType().getId() + "\n");
            ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE);
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            RevFeature revFeature = RevFeatureBuilder.build(feature.getFeature());
            try {
                writer.write(revFeature, output);
            } catch (IOException e) {
            }
            sb.append(output.toString());
            sb.append('\n');
        }
        for (FeatureInfo feature : patch.getRemovedFeatures()) {
            String path = feature.getPath();
            sb.append("R\t" + path + "\t" + feature.getFeatureType().getId() + "\n");
            ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE);
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            RevFeature revFeature = RevFeatureBuilder.build(feature.getFeature());
            try {
                writer.write(revFeature, output);
            } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.storage.text.TextSerializationFactory

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.