org.simantics.databoard
Class Files

java.lang.Object
  extended by org.simantics.databoard.Files

public class Files
extends java.lang.Object


Constructor Summary
Files()
           
 
Method Summary
static void createFile(java.io.File file)
          Create a new binary file (.dbb) with an empty value.
static void createFile(java.io.File file, Binding binding, java.lang.Object value)
          Create a binary file (.dbb) with a initial value.
static void createFile(java.io.File file, DataType type)
          Create a binary file (.dbb) with empty value of given type.
static java.lang.Object readFile(java.io.File file, Binding binding)
          Read a binary file into a java instance.
static java.lang.Object readFile(java.io.InputStream is, Binding binding)
          Read input stream into a java instance.
static java.lang.Object readFile(java.io.InputStream is, long streamLength, Binding binding)
          Read input stream into a java instance.
static DataType readFileType(java.io.File file)
          Read file type of a binary file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Files

public Files()
Method Detail

createFile

public static void createFile(java.io.File file,
                              Binding binding,
                              java.lang.Object value)
                       throws java.io.IOException,
                              SerializationException,
                              BindingException
Create a binary file (.dbb) with a initial value. Binary file is a variant, there is a filetype in the header of the file. If old file exists, it is deleted.

Parameters:
file -
binding -
value -
Throws:
java.io.IOException
BindingException
SerializationException

createFile

public static void createFile(java.io.File file)
                       throws java.io.IOException,
                              RuntimeSerializerConstructionException,
                              SerializationException,
                              BindingException
Create a new binary file (.dbb) with an empty value. Binary file is a variant, there is a filetype in the header of the file. If old file exists, it is deleted.

Parameters:
file -
Throws:
java.io.IOException
BindingException
SerializationException
RuntimeSerializerConstructionException
Since:
0.5

createFile

public static void createFile(java.io.File file,
                              DataType type)
                       throws java.io.IOException,
                              BindingException,
                              RuntimeSerializerConstructionException,
                              SerializationException
Create a binary file (.dbb) with empty value of given type. Binary file is a variant, there is a filetype in the header of the file. If old file exists, it is deleted.

Parameters:
file -
type -
Throws:
java.io.IOException
BindingException
SerializationException
RuntimeSerializerConstructionException

readFileType

public static DataType readFileType(java.io.File file)
                             throws java.io.IOException,
                                    SerializationException,
                                    BindingException
Read file type of a binary file.

Parameters:
file -
Returns:
Throws:
java.io.IOException
BindingException
SerializationException

readFile

public static java.lang.Object readFile(java.io.File file,
                                        Binding binding)
                                 throws java.io.IOException,
                                        SerializationException
Read a binary file into a java instance. Binary file is a variant, there is a filetype in the header of the file. If requested binding is not the exact binding of the file, an adapter is tried.

Parameters:
file - file
binding - content binding
Returns:
instance
Throws:
SerializationException
AccessorException
java.io.IOException

readFile

public static java.lang.Object readFile(java.io.InputStream is,
                                        Binding binding)
                                 throws java.io.IOException,
                                        SerializationException
Read input stream into a java instance. Binary file is a variant, there is a filetype in the header of the file. If requested binding is not the exact binding of the file, an adapter is tried.

Parameters:
is - input stream
binding - content binding
Returns:
instance
Throws:
SerializationException
AccessorException
java.io.IOException

readFile

public static java.lang.Object readFile(java.io.InputStream is,
                                        long streamLength,
                                        Binding binding)
                                 throws java.io.IOException,
                                        SerializationException
Read input stream into a java instance. If requested binding is not the exact binding of the file, an adapter is tried.

Parameters:
is - input stream
streamLength -
binding - content binding
Returns:
instance
Throws:
SerializationException
AccessorException
java.io.IOException