Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.util.file
Class FileWriter

    java.lang.Object
      org.hyperic.util.file.FileWriter

    public class FileWriter

extends java.lang.Object

A class which has the ability to write to files, deal with permissions/ownership, and rollback changes later on.

Constructor Summary
`FileWriter(java.io.File destFile, byte[] data)`
`FileWriter(java.io.File destFile, java.io.InputStream inStream, long size)`

Method Summary
`void` | `cleanup()`
`protected static void` | `copyStream(java.io.InputStream is, java.io.OutputStream os, long totalToCopy)`
`java.io.File` | `getDestFile()`
`boolean` | `hasWritten()`
`boolean` | `isCreateOnly()`
`boolean` | `isCreateOrOverwrite()`
`boolean` | `isRewrite()`
`void` | `rollback()`
`void` | `setCreateOnly()`
`void` | `setCreateOrOverwrite()`
`void` | `setRewrite()`
`void` | `setVerifyMD5CheckSumOnWrite(java.lang.String expectedMD5sum)` Verify the MD5 check sum on file write.
`void` | `verifyMD5CheckSum()` Verify the MD5 check sum of the written file.
`void` | `write()` Write the file.

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

Constructor Detail

### FileWriter

    public FileWriter(java.io.File destFile,
                      java.io.InputStream inStream,
                      long size)

### FileWriter

    public FileWriter(java.io.File destFile,
                      byte[] data)

Method Detail

### setVerifyMD5CheckSumOnWrite

    public void setVerifyMD5CheckSumOnWrite(java.lang.String expectedMD5sum)

  Verify the MD5 check sum on file write.

  Parameters:
    `expectedMD5sum` - The expected MD5 check sum.

### getDestFile

    public java.io.File getDestFile()

### setCreateOnly

    public void setCreateOnly()

### isCreateOnly

    public boolean isCreateOnly()

### setCreateOrOverwrite

    public void setCreateOrOverwrite()

### isCreateOrOverwrite

    public boolean isCreateOrOverwrite()

### setRewrite

    public void setRewrite()

### isRewrite

    public boolean isRewrite()

### rollback

    public void rollback()
                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### cleanup

    public void cleanup()

### write

    public void write()
               throws java.io.IOException

  Write the file.

  Throws:
    `java.io.IOException` - if the file write fails.

### verifyMD5CheckSum

    public void verifyMD5CheckSum()
                           throws java.io.IOException

  Verify the MD5 check sum of the written file.

  Throws:
    `java.io.IOException` - if the MD5 check sum verification fails.
    `java.lang.IllegalStateException` - if the file has not been written yet.

### hasWritten

    public boolean hasWritten()

### copyStream

    protected static void copyStream(java.io.InputStream is,
                                     java.io.OutputStream os,
                                     long totalToCopy)
                              throws java.io.IOException

  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.