org.eclipse.osgi.internal.baseadaptor
Class AdaptorUtil

java.lang.Object
  extended by org.eclipse.osgi.internal.baseadaptor.AdaptorUtil

public class AdaptorUtil
extends java.lang.Object

A utility class with some generally useful static methods for adaptor hook implementations


Field Summary
static byte NULL
          The NULL tag used in bundle storage
static byte OBJECT
          The OBJECT tag used in bundle storage
 
Constructor Summary
AdaptorUtil()
           
 
Method Summary
static boolean canWrite(java.io.File installDir)
           
static void copyDir(java.io.File inDir, java.io.File outDir)
          Does a recursive copy of one directory to another.
static java.net.URL encodeFileURL(java.io.File file)
           
static java.util.Dictionary loadManifestFrom(BaseData bundledata)
           
static Version loadVersion(java.io.DataInputStream in)
           
static void readFile(java.io.InputStream in, java.io.File file)
          Read a file from an InputStream and write it to the file system.
static java.lang.String readString(java.io.DataInputStream in, boolean intern)
           
static ServiceRegistration register(java.lang.String name, java.lang.Object service, BundleContext context)
          Register a service object.
static boolean rm(java.io.File file)
          This function performs the equivalent of "rm -r" on a file or directory.
static void writeStringOrNull(java.io.DataOutputStream out, java.lang.String string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final byte NULL
The NULL tag used in bundle storage

See Also:
Constant Field Values

OBJECT

public static final byte OBJECT
The OBJECT tag used in bundle storage

See Also:
Constant Field Values
Constructor Detail

AdaptorUtil

public AdaptorUtil()
Method Detail

copyDir

public static void copyDir(java.io.File inDir,
                           java.io.File outDir)
                    throws java.io.IOException
Does a recursive copy of one directory to another.

Parameters:
inDir - input directory to copy.
outDir - output directory to copy to.
Throws:
java.io.IOException - if any error occurs during the copy.

readFile

public static void readFile(java.io.InputStream in,
                            java.io.File file)
                     throws java.io.IOException
Read a file from an InputStream and write it to the file system.

Parameters:
in - InputStream from which to read. This stream will be closed by this method.
file - output file to create.
Throws:
java.io.IOException

rm

public static boolean rm(java.io.File file)
This function performs the equivalent of "rm -r" on a file or directory.

Parameters:
file - file or directory to delete
Returns:
false is the specified files still exists, true otherwise.

readString

public static java.lang.String readString(java.io.DataInputStream in,
                                          boolean intern)
                                   throws java.io.IOException
Throws:
java.io.IOException

writeStringOrNull

public static void writeStringOrNull(java.io.DataOutputStream out,
                                     java.lang.String string)
                              throws java.io.IOException
Throws:
java.io.IOException

loadVersion

public static Version loadVersion(java.io.DataInputStream in)
                           throws java.io.IOException
Throws:
java.io.IOException

register

public static ServiceRegistration register(java.lang.String name,
                                           java.lang.Object service,
                                           BundleContext context)
Register a service object.

Parameters:
name - the service class name
service - the service object
context - the registering bundle context
Returns:
the service registration object

loadManifestFrom

public static java.util.Dictionary loadManifestFrom(BaseData bundledata)
                                             throws BundleException
Throws:
BundleException

canWrite

public static boolean canWrite(java.io.File installDir)

encodeFileURL

public static java.net.URL encodeFileURL(java.io.File file)
                                  throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.