~ubuntu-branches/debian/lenny/redland-bindings/lenny

« back to all changes in this revision

Viewing changes to java/org/librdf/redland/Serializer.java

  • Committer: Bazaar Package Importer
  • Author(s): Dave Beckett
  • Date: 2007-12-27 22:22:07 UTC
  • mfrom: (0.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20071227222207-hxy4hqsw2oupruq5
Tags: 1.0.7.1-1
* New upstream release
* Add /etc/php5/conf.d/redland.ini file to php5-librdf

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode: java; c-basic-offset: 2 -*-
2
 
//
3
 
// Serializer.java - Redland Java Serializer class
4
 
//
5
 
// $Id: Serializer.java 10591 2006-03-05 08:22:09Z cmdjb $
6
 
//
7
 
// Copyright (C) 2002-2004 David Beckett - http://purl.org/net/dajobe/
8
 
// Copyright (C) 2002-2004 University of Bristol - http://www.bristol.ac.uk/
9
 
// 
10
 
// This package is Free Software or Open Source available under the
11
 
// following licenses (these are alternatives):
12
 
//   1. GNU Lesser General Public License (LGPL)
13
 
//   2. GNU General Public License (GPL)
14
 
//   3. Mozilla Public License (MPL)
15
 
// 
16
 
// See LICENSE.html or LICENSE.txt at the top of this package for the
17
 
// full license terms.
18
 
// 
19
 
// 
20
 
//
21
 
 
22
 
package org.librdf.redland;
23
 
 
24
 
import org.librdf.redland.core;
25
 
import org.librdf.redland.World;
26
 
import org.librdf.redland.URI;
27
 
 
28
 
public class Serializer
29
 
{
30
 
  private long object;
31
 
  private World world;
32
 
 
33
 
  public Serializer (World world, String name, String mime_type, URI type_uri) 
34
 
    {
35
 
      this.world=world;
36
 
      long uri_object=(type_uri == null) ? 0 : type_uri.__get_object();
37
 
      this.object=core.librdf_new_serializer(world.__get_object(), name, mime_type, uri_object);
38
 
    }
39
 
  
40
 
  public void finished()
41
 
    {
42
 
      if(this.object != 0) {
43
 
        core.librdf_free_serializer(this.object);
44
 
        this.object=0;
45
 
        this.world=null;
46
 
      }
47
 
    }
48
 
 
49
 
 
50
 
  public boolean serialize_to_file(String filename, URI base_uri, Model model) 
51
 
    {
52
 
      int result=core.librdf_serializer_serialize_model_to_file(this.object, filename, base_uri.__get_object(), model.__get_object());
53
 
      return (result != 0);
54
 
    }
55
 
 
56
 
  
57
 
  public Node getFeature(URI feature) 
58
 
    {
59
 
      return new Node(this.world, core.librdf_serializer_get_feature(this.object, feature.__get_object()), true);
60
 
    }
61
 
 
62
 
  
63
 
  public int setFeature(URI feature, Node value) 
64
 
    {
65
 
      return core.librdf_serializer_set_feature(this.object, feature.__get_object(), value.__get_object());
66
 
    }
67
 
  
68
 
}