Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.birt.core.archive
Class ArchiveUtil

    java.lang.Object
      org.eclipse.birt.core.archive.ArchiveUtil

    public class ArchiveUtil

extends java.lang.Object

Field Summary
`protected static java.util.logging.Logger` | `logger`
`static java.lang.String` | `UNIX_SEPERATOR`

Constructor Summary
`ArchiveUtil()`

Method Summary
`static void` | `archive(java.lang.String folderName, IStreamSorter sorter, java.lang.String fileName)` Compound File Format: 1long(stream section position) + 1long(entry number in lookup map) + lookup map section + stream data section The Lookup map is a hash map.
`static void` | `archive(java.lang.String folder, java.lang.String file)`
`static int` | `bytesToInteger(byte[] b)` Assemble four bytes to an int value, make sure that the passed bytes length is larger than 4.
`static int` | `bytesToInteger(byte[] b, int off)`
`static long` | `bytesToLong(byte[] b)` Assemble eight bytes to an long value, make sure that the passed bytes length larger than 8.
`static long` | `bytesToLong(byte[] b, int off)`
`static void` | `copy(IArchiveFile inArchive, IArchiveFile outArchive)`
`static void` | `copy(IDocArchiveReader reader, IDocArchiveWriter writer)`
`static void` | `createParentFolder(java.io.File fd)` If the parent folder of the file doesn't exsit, create the parent folder.
`static void` | `deleteAllFiles(java.io.File dirOrFile)` Recursively delete all the files and folders under dirOrFile
`static void` | `expand(java.lang.String file, java.lang.String folder)`
`static java.lang.String` | `generateFullPath(java.lang.String rootPath, java.lang.String relativePath)`
`static java.lang.String` | `generateRelativePath(java.lang.String rootPath, java.lang.String fullPath)`
`static java.lang.String` | `generateUniqueFileFolderName(java.lang.String originalName)` Generate a unique file or folder name which is in the same folder as the originalName
`static void` | `integerToBytes(int v, byte[] b)`
`static void` | `integerToBytes(int v, byte[] b, int off)`
`static void` | `listAllFiles(java.io.File dir, java.util.ArrayList fileList)` Get all the files under the specified folder (including all the files under sub-folders)
`static void` | `longToBytes(long v, byte[] b)`
`static void` | `longToBytes(long v, byte[] b, int off)`
`static void` | `unzipArchive(java.io.File zipArchive, java.lang.String tempFolderPath)`
`static void` | `zipFolderToStream(java.lang.String tempFolderPath, java.io.OutputStream ostream)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    protected static java.util.logging.Logger logger

### UNIX_SEPERATOR

    public static java.lang.String UNIX_SEPERATOR

Constructor Detail

### ArchiveUtil

    public ArchiveUtil()

Method Detail

### generateFullPath

    public static java.lang.String generateFullPath(java.lang.String rootPath,
                                                    java.lang.String relativePath)

  Parameters:
    `rootPath` - - the absolute path of the root folder. The path is seperated by system's File seperator.
    `relativePath` - - the relative path. The path is either seperated by system's File seperator or seperated by Unix seperator "/".
  Returns:
    the absolute path which concats rootPath and relativePath. The full path is seperated by system's File seperator. The returned absolute path can be used directly to locate the file.

### generateRelativePath

    public static java.lang.String generateRelativePath(java.lang.String rootPath,
                                                        java.lang.String fullPath)

  Parameters:
    `rootPath` - - the absolute path of the root folder. The path is seperated by system's File seperator.
    `fullString` - - the absolute path of the stream. The path is seperated by system's File seperator.
  Returns:
    the relative path string. The path is based on Unix syntax and starts with "/".

### generateUniqueFileFolderName

    public static java.lang.String generateUniqueFileFolderName(java.lang.String originalName)

  Generate a unique file or folder name which is in the same folder as the originalName

  Parameters:
    `originalName` - - the original Name. For example, it could be the name of the file archive
  Returns:
    a unique file or folder name which is in the same folder as the originalName

### createParentFolder

    public static void createParentFolder(java.io.File fd)

  If the parent folder of the file doesn't exsit, create the parent folder.

### deleteAllFiles

    public static void deleteAllFiles(java.io.File dirOrFile)

  Recursively delete all the files and folders under dirOrFile

  Parameters:
    `dirOrFile` - - the File object which could be either a folder or a file.

### zipFolderToStream

    public static void zipFolderToStream(java.lang.String tempFolderPath,
                                         java.io.OutputStream ostream)

### unzipArchive

    public static void unzipArchive(java.io.File zipArchive,
                                    java.lang.String tempFolderPath)

### copy

    public static void copy(IArchiveFile inArchive,
                            IArchiveFile outArchive)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### copy

    public static void copy(IDocArchiveReader reader,
                            IDocArchiveWriter writer)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### archive

    public static void archive(java.lang.String folder,
                               java.lang.String file)
                        throws java.io.IOException

  Throws:
    `java.io.IOException`

### archive

    public static void archive(java.lang.String folderName,
                               IStreamSorter sorter,
                               java.lang.String fileName)
                        throws java.io.IOException

  Compound File Format:
  1long(stream section position) + 1long(entry number in lookup map) + lookup map section + stream data section
  The Lookup map is a hash map. The key is the relative path of the stram. The entry contains two long number. The first long is the start postion. The second long is the length of the stream.

  Parameters:
    `tempFolder` -
    `fileArchiveName` - - the file archive name
  Throws:
    `java.io.IOException`

### listAllFiles

    public static void listAllFiles(java.io.File dir,
                                    java.util.ArrayList fileList)

  Get all the files under the specified folder (including all the files under sub-folders)

  Parameters:
    `dir` - - the folder to look into
    `fileList` - - the fileList to be returned

### expand

    public static void expand(java.lang.String file,
                              java.lang.String folder)
                       throws java.io.IOException

  Throws:
    `java.io.IOException`

### bytesToInteger

    public static final int bytesToInteger(byte[] b)

  Assemble four bytes to an int value, make sure that the passed bytes length is larger than 4.

  Parameters:
    `bytes` -
  Returns:
    int value of bytes

### bytesToInteger

    public static final int bytesToInteger(byte[] b,
                                           int off)

### bytesToLong

    public static final long bytesToLong(byte[] b)

  Assemble eight bytes to an long value, make sure that the passed bytes length larger than 8.

  Parameters:
    `bytes` -
  Returns:
    int value of bytes

### bytesToLong

    public static final long bytesToLong(byte[] b,
                                         int off)

### integerToBytes

    public static final void integerToBytes(int v,
                                            byte[] b)

### integerToBytes

    public static final void integerToBytes(int v,
                                            byte[] b,
                                            int off)

### longToBytes

    public static final void longToBytes(long v,
                                         byte[] b)

### longToBytes

    public static final void longToBytes(long v,
                                         byte[] b,
                                         int off)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Actuate Corp. All rights reserved.