Package com.iizix.util
Class XOutputFile
java.lang.Object
com.iizix.util.XOutputFile
This class is used for creating and writing to files that are stored using Phantom Hurricane in OEM ASCII or Ansi character set.
- Field SummaryFieldsModifier and TypeFieldDescription- static final byte[]The New Line separator bytes for ISO character encoding.- static final StringThe New Line separator.
- Constructor SummaryConstructorsConstructorDescriptionCreates a in-memory byte array output stream where the contents can be retrieved by means of getByteArrayOutputStream() or getByteArray() methods.- XOutputFile- (File file) Creates the specified file for write.- XOutputFile- (OutputStream out) Creates an instance for the output stream.- XOutputFile- (String fileName) Creates the specified file for write.- XOutputFile- (String fileName, XFile openFile) Creates the specified file for write.- XOutputFile- (String fileName, String previousFile) Creates the specified file for write.
- Method SummaryModifier and TypeMethodDescription- void- close()Close stream and file- byte[]Gets the written data as a byte array when the file refers to an in-memory file.Gets the byte array output stream instance.Gets the data output stream instance.Gets the file output stream instance.Gets the file output stream instance.- void- writeByte- (byte d) Write a byte to the file.- void- writeByte- (int d) Write a byte to the file.- void- writeBytes- (byte[] d) Write a byte array to the file.- void- writeBytes- (byte[] d, int offset, int length) Write a byte array to the file.- void- writeIntelLong- (int v) Writes an Intel formatted Long (32 bit value).- void- writeIntelShort- (int v) Writes an Intel formatted Short (16 bit signed value).- void- writeIntelUShort- (int v) Writes an Intel formatted UShort (16 bit unsigned value).- void- writeISOLine- (String line) Writes a string as a line in a file encoded in ISO 8859-1 character set.- void- writeLine- (byte[] line) Writes an array of bytes to file and append line separator.- voidWrites a string to its length using the OEM (ASCII) character set.- void- writeOEMString- (String s, int length, byte pad) Writes a string padded to the specified length with the padding character.- void- writeOEMString- (String s, int length, int pad) Writes a string padded to the specified length with the padding character.- voidConverts a vector of unicode strings to ASCII bytes and writes them to file using environment dependent line separator.- void- writeString- (String s, int length, byte pad) Writes a string padded to the specified length with the padding character.- void- writeString- (String s, int length, int pad) Writes a string padded to the specified length with the padding character.- voidWrites a string to its length in Unicode.- void- writeUnicodeString- (String s, int length, char pad) Writes a string padded to the specified length with the padding character.- voidWrites a zero-terminated Unicode string, if the string contains a zero-termination character, it will end there.
- Field Details- newLineThe New Line separator.
- isoNewLinepublic static final byte[] isoNewLineThe New Line separator bytes for ISO character encoding.
 
- Constructor Details- XOutputFileCreates the specified file for write.- Throws:
- IOException- if an I/O error occurs.
 
- XOutputFileCreates the specified file for write.- Throws:
- IOException- if an I/O error occurs.
 
- XOutputFileCreates the specified file for write. The directory of the file name is taken from the instance of the PhantomFile passed into this method.- Throws:
- IOException- if an I/O error occurs.
 
- XOutputFileCreates the specified file for write. The directory of the file name is taken from the file name passed into this method.- Throws:
- IOException- if an I/O error occurs.
 
- XOutputFileCreates an instance for the output stream.
- XOutputFilepublic XOutputFile()Creates a in-memory byte array output stream where the contents can be retrieved by means of getByteArrayOutputStream() or getByteArray() methods.
 
- Method Details- closeClose stream and file- Throws:
- IOException- if an I/O error occurs.
 
- writeOEMStringVectorConverts a vector of unicode strings to ASCII bytes and writes them to file using environment dependent line separator.- Throws:
- IOException- if an I/O error occurs.
 
- writeLineWrites an array of bytes to file and append line separator.- Throws:
- IOException- if an I/O error occurs.
 
- writeISOLineWrites a string as a line in a file encoded in ISO 8859-1 character set. The line is terminated with [CR]LF (Hex [0x0D] 0x0A) only in order to have the same character under Windows, Unix and EBCDIC environments.- Typically, this function is used to write data that is then read with PhantomFile.readISOLine. - Throws:
- IOException- if an I/O error occurs.
- See Also:
 
- writeBytesWrite a byte array to the file.- Throws:
- IOException- if an I/O error occurs.
 
- writeBytesWrite a byte array to the file.- Throws:
- IOException- if an I/O error occurs.
 
- writeByteWrite a byte to the file.- Throws:
- IOException- if an I/O error occurs.
 
- writeByteWrite a byte to the file.- Throws:
- IOException- if an I/O error occurs.
 
- writeOEMStringWrites a string to its length using the OEM (ASCII) character set.- Throws:
- IOException- if an I/O error occurs.
 
- writeOEMStringWrites a string padded to the specified length with the padding character. If the string is longer than the specified length, it will be truncated.- Throws:
- IOException- if an I/O error occurs.
 
- writeOEMStringWrites a string padded to the specified length with the padding character. If the string is longer than the specified length, it will be truncated.- Throws:
- IOException- if an I/O error occurs.
 
- writeStringWrites a string padded to the specified length with the padding character. If the string is longer than the specified length, it will be truncated.- Throws:
- IOException- if an I/O error occurs.
 
- writeStringWrites a string padded to the specified length with the padding character. If the string is longer than the specified length, it will be truncated.- Throws:
- IOException- if an I/O error occurs.
 
- writeUnicodeStringWrites a string to its length in Unicode.- Throws:
- IOException- if an I/O error occurs.
 
- writeZeroTermUnicodeStringWrites a zero-terminated Unicode string, if the string contains a zero-termination character, it will end there.- Throws:
- IOException- if an I/O error occurs.
 
- writeUnicodeStringWrites a string padded to the specified length with the padding character. If the string is longer than the specified length, it will be truncated.- Throws:
- IOException- if an I/O error occurs.
 
- writeIntelLongWrites an Intel formatted Long (32 bit value). It doesn't matter if it's a ULong or Long (signed value), because the 32 bit implementation will always treat it as signed.- Throws:
- IOException- if an I/O error occurs.
 
- writeIntelShortWrites an Intel formatted Short (16 bit signed value).- Throws:
- IOException- if an I/O error occurs.
 
- writeIntelUShortWrites an Intel formatted UShort (16 bit unsigned value).- Throws:
- IOException- if an I/O error occurs.
 
- getDataOutputStreamGets the data output stream instance.
- getFileOutputStreamGets the file output stream instance. This method returns null when the XOutputFile is an in-memory byte array output stream.
- getByteArrayOutputStreamGets the byte array output stream instance. This method returns null when the XOutputFile is not an in-memory byte array output stream, but rather an output file.
- getOutputStreamGets the file output stream instance.
- getByteArraypublic byte[] getByteArray()Gets the written data as a byte array when the file refers to an in-memory file. Otherwise null is returned.