Package hec.io
Class SimpleFile
java.lang.Object
java.io.File
hec.io.SimpleFile
- All Implemented Interfaces:
HecFile,Serializable,Comparable<File>
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static booleanDefault value for write to a tmp file.protected booleanwhether to write to a tmp file instead of the real file during writesprotected static final Stringextension used for backup filesprotected static final Stringextension used for temp filesFields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar -
Constructor Summary
ConstructorsConstructorDescriptionSimpleFile(File parent, String child) SimpleFile(String pathname) SimpleFile(String parent, String child) -
Method Summary
Modifier and TypeMethodDescriptionbooleanappendByteArray(byte[] byteArray) Appends byteArray to the end of this file.voidclose()Closes any open writers and flushes their data to disk.protected voidcopies src to dest - does no checking of the files.Get a BufferedWriter to append to the end of this file.Get a DataOutputStream for appending to the end of this file.Get a BufferedReader for this file.Get a BufferedWriter to write to this file.byte[]Get the byte[] representing this HecFile's data.byte[]getByteArray(boolean compress) Return a byte[] containing the data from the File.byte[]getByteArray(long off, int len) Get the byte[] representing this HecFile's data starting at offset for the length amount.Get a ByteArrayInputStream for this file.Get a ByteArrayOutputStream for this file.longGet the check sum for this file.Get a DataInputStream for this file.Get a DataOutputStream for writing to this file.Get an EndianInputStream for this file.Get an EndianOutputStream for this file.Get an ObjectInputStream for this file.Get an ObjectOutputStream for this file.booleanreturn whether thisHecFileis using Compression to read/write data to theRmiFilebooleanGet whether this HecFile represents a networked or local file.booleanLock this file with fLock.voidSend message to all callback objects registered with this file.booleansave()Save the contents of any writers that are currently in use.booleansetByteArray(byte[] byteArray) Set this HecFile's data to byteArray starting at the beginning of the filevoidsetUseCompression(boolean compress) set whether thisHecFileshould use compression to read/write data to/from theRmiFilestatic voidsetWriteToTmpFile(boolean writeToTmp) booleanunlockFile(FileLock fLock) Unlock this file with fLock.voidwriteBytes(long bytePos, byte[] bytes) voidwriteFloat(long bytePos, float f) Write a float f to position bytePos in this HecFile.Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURLMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface hec.io.HecFile
canRead, canWrite, exists, getLineSeparator, getName, getPath, isDirectory, isFile, lastModified, length, mkdirs
-
Field Details
-
TMP_EXTENSION
extension used for temp files- See Also:
-
BAK_EXTENSION
extension used for backup files- See Also:
-
_staticWriteToTmpDefault
protected static boolean _staticWriteToTmpDefaultDefault value for write to a tmp file. -
_writeToTmp
protected boolean _writeToTmpwhether to write to a tmp file instead of the real file during writes
-
-
Constructor Details
-
SimpleFile
- Parameters:
parent-child-
-
SimpleFile
-
SimpleFile
-
-
Method Details
-
setWriteToTmpFile
public static void setWriteToTmpFile(boolean writeToTmp) -
appendByteArray
public boolean appendByteArray(byte[] byteArray) Description copied from interface:HecFileAppends byteArray to the end of this file.- Specified by:
appendByteArrayin interfaceHecFile- Parameters:
byteArray-- Returns:
- See Also:
-
copyFile
copies src to dest - does no checking of the files.- Throws:
IOException
-
close
Description copied from interface:HecFileCloses any open writers and flushes their data to disk.- Specified by:
closein interfaceHecFile- Throws:
IOException- See Also:
-
getAppendedBufferedWriter
Description copied from interface:HecFileGet a BufferedWriter to append to the end of this file.- Specified by:
getAppendedBufferedWriterin interfaceHecFile- Returns:
- See Also:
-
getAppendedDataOutputStream
Description copied from interface:HecFileGet a DataOutputStream for appending to the end of this file.- Specified by:
getAppendedDataOutputStreamin interfaceHecFile- Returns:
- See Also:
-
getBufferedReader
Description copied from interface:HecFileGet a BufferedReader for this file.- Specified by:
getBufferedReaderin interfaceHecFile- Returns:
- See Also:
-
getBufferedWriter
Description copied from interface:HecFileGet a BufferedWriter to write to this file.- Specified by:
getBufferedWriterin interfaceHecFile- Returns:
- See Also:
-
getByteArray
public byte[] getByteArray()Description copied from interface:HecFileGet the byte[] representing this HecFile's data. This may or may not be the complete contents of the file.- Specified by:
getByteArrayin interfaceHecFile- Returns:
- See Also:
-
getByteArray
public byte[] getByteArray(boolean compress) Return a byte[] containing the data from the File.- Parameters:
compress- flag indicating whether to compress the byte[] being returned
-
getByteArray
public byte[] getByteArray(long off, int len) Description copied from interface:HecFileGet the byte[] representing this HecFile's data starting at offset for the length amount. The may or may not be the complete contents of the file.- Specified by:
getByteArrayin interfaceHecFile- Parameters:
off-len-- Returns:
- See Also:
-
getByteArrayInputStream
Description copied from interface:HecFileGet a ByteArrayInputStream for this file.- Specified by:
getByteArrayInputStreamin interfaceHecFile- Returns:
- See Also:
-
getByteArrayOutputStream
Description copied from interface:HecFileGet a ByteArrayOutputStream for this file.- Specified by:
getByteArrayOutputStreamin interfaceHecFile- Returns:
- See Also:
-
getCheckSum
public long getCheckSum()Description copied from interface:HecFileGet the check sum for this file.- Specified by:
getCheckSumin interfaceHecFile- Returns:
- See Also:
-
getDataInputStream
Description copied from interface:HecFileGet a DataInputStream for this file.- Specified by:
getDataInputStreamin interfaceHecFile- Returns:
- See Also:
-
getDataOutputStream
Description copied from interface:HecFileGet a DataOutputStream for writing to this file.- Specified by:
getDataOutputStreamin interfaceHecFile- Returns:
- See Also:
-
getEndianInputStream
Description copied from interface:HecFileGet an EndianInputStream for this file.- Specified by:
getEndianInputStreamin interfaceHecFile- Returns:
- See Also:
-
getEndianOutputStream
Description copied from interface:HecFileGet an EndianOutputStream for this file.- Specified by:
getEndianOutputStreamin interfaceHecFile- Returns:
- See Also:
-
getObjectInputStream
Description copied from interface:HecFileGet an ObjectInputStream for this file.- Specified by:
getObjectInputStreamin interfaceHecFile- Returns:
- See Also:
-
getObjectOutputStream
Description copied from interface:HecFileGet an ObjectOutputStream for this file.- Specified by:
getObjectOutputStreamin interfaceHecFile- Returns:
- Throws:
IOException- See Also:
-
getUsingCompression
public boolean getUsingCompression()Description copied from interface:HecFilereturn whether thisHecFileis using Compression to read/write data to theRmiFile- Specified by:
getUsingCompressionin interfaceHecFile- Returns:
- See Also:
-
isNetworked
public boolean isNetworked()Description copied from interface:HecFileGet whether this HecFile represents a networked or local file.- Specified by:
isNetworkedin interfaceHecFile- Returns:
- See Also:
-
lockFile
Description copied from interface:HecFileLock this file with fLock. -
notify
Description copied from interface:HecFileSend message to all callback objects registered with this file. -
save
public boolean save()Description copied from interface:HecFileSave the contents of any writers that are currently in use. -
setByteArray
public boolean setByteArray(byte[] byteArray) Description copied from interface:HecFileSet this HecFile's data to byteArray starting at the beginning of the file- Specified by:
setByteArrayin interfaceHecFile- Parameters:
byteArray-- Returns:
- See Also:
-
setUseCompression
public void setUseCompression(boolean compress) Description copied from interface:HecFileset whether thisHecFileshould use compression to read/write data to/from theRmiFile- Specified by:
setUseCompressionin interfaceHecFile- Parameters:
compress-- See Also:
-
unlockFile
Description copied from interface:HecFileUnlock this file with fLock.- Specified by:
unlockFilein interfaceHecFile- Parameters:
fLock-- Returns:
- See Also:
-
writeBytes
public void writeBytes(long bytePos, byte[] bytes) - Specified by:
writeBytesin interfaceHecFile
-
writeFloat
public void writeFloat(long bytePos, float f) Description copied from interface:HecFileWrite a float f to position bytePos in this HecFile.- Specified by:
writeFloatin interfaceHecFile- Parameters:
bytePos-f-- See Also:
-