public class AdaptorUtil extends Object
Modifier and Type | Field and Description |
---|---|
static byte |
NULL
The NULL tag used in bundle storage
|
static byte |
OBJECT
The OBJECT tag used in bundle storage
|
Constructor and Description |
---|
AdaptorUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canWrite(File installDir) |
static void |
copyDir(File inDir,
File outDir)
Does a recursive copy of one directory to another.
|
static URL |
encodeFileURL(File file) |
static byte[] |
getBytes(InputStream in,
int length,
int BUF_SIZE) |
static Dictionary<String,String> |
loadManifestFrom(BaseData bundledata) |
static Version |
loadVersion(DataInputStream in) |
static void |
readFile(InputStream in,
File file)
Read a file from an InputStream and write it to the file system.
|
static String |
readString(DataInputStream in,
boolean intern) |
static ServiceRegistration<?> |
register(String name,
Object service,
BundleContext context)
Register a service object.
|
static boolean |
rm(File file)
This function performs the equivalent of "rm -r" on a file or directory.
|
static void |
writeStringOrNull(DataOutputStream out,
String string) |
public static final byte NULL
public static final byte OBJECT
public static void copyDir(File inDir, File outDir) throws IOException
inDir
- input directory to copy.outDir
- output directory to copy to.IOException
- if any error occurs during the copy.public static void readFile(InputStream in, File file) throws IOException
in
- InputStream from which to read. This stream will be closed by this method.file
- output file to create.IOException
public static boolean rm(File file)
file
- file or directory to deletepublic static String readString(DataInputStream in, boolean intern) throws IOException
IOException
public static void writeStringOrNull(DataOutputStream out, String string) throws IOException
IOException
public static Version loadVersion(DataInputStream in) throws IOException
IOException
public static ServiceRegistration<?> register(String name, Object service, BundleContext context)
name
- the service class nameservice
- the service objectcontext
- the registering bundle contextpublic static Dictionary<String,String> loadManifestFrom(BaseData bundledata) throws BundleException
BundleException
public static boolean canWrite(File installDir)
public static URL encodeFileURL(File file) throws MalformedURLException
MalformedURLException
public static byte[] getBytes(InputStream in, int length, int BUF_SIZE) throws IOException
IOException
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.