git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896139 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_2_0
* @param strings The table of strings that may be referenced by cells in the sheet | * @param strings The table of strings that may be referenced by cells in the sheet | ||||
* @param sheetInputStream The stream to read the sheet-data from. | * @param sheetInputStream The stream to read the sheet-data from. | ||||
* @exception java.io.IOException An IO exception from the parser, | |||||
* @throws java.io.IOException An IO exception from the parser, | |||||
* possibly from a byte stream or character stream | * possibly from a byte stream or character stream | ||||
* supplied by the application. | * supplied by the application. | ||||
* @throws SAXException if parsing the XML data fails. | * @throws SAXException if parsing the XML data fails. |
* @param path the path to the document | * @param path the path to the document | ||||
* @return the new OPCPackage | * @return the new OPCPackage | ||||
* | * | ||||
* @exception IOException if there was a problem opening the document | |||||
* @throws IOException if there was a problem opening the document | |||||
*/ | */ | ||||
public static OPCPackage openPackage(String path) throws IOException { | public static OPCPackage openPackage(String path) throws IOException { | ||||
try { | try { | ||||
* | * | ||||
* @param stream - the java OutputStream you wish to write the file to | * @param stream - the java OutputStream you wish to write the file to | ||||
* | * | ||||
* @exception IOException if anything can't be written. | |||||
* @throws IOException if anything can't be written. | |||||
*/ | */ | ||||
@SuppressWarnings("resource") | @SuppressWarnings("resource") | ||||
public final void write(OutputStream stream) throws IOException { | public final void write(OutputStream stream) throws IOException { |
* @param part part to put | * @param part part to put | ||||
* @return the previous value associated with {@code partName}, or | * @return the previous value associated with {@code partName}, or | ||||
* {@code null} if there was no mapping for {@code partName}. | * {@code null} if there was no mapping for {@code partName}. | ||||
* @exception InvalidOperationException | |||||
* @throws InvalidOperationException | |||||
* Throws if you try to add a part with a name derived from | * Throws if you try to add a part with a name derived from | ||||
* another part name. | * another part name. | ||||
*/ | */ |
* @param partName | * @param partName | ||||
* The part URI associated with the override content type to | * The part URI associated with the override content type to | ||||
* delete. | * delete. | ||||
* @exception InvalidOperationException | |||||
* @throws InvalidOperationException | |||||
* Throws if | * Throws if | ||||
*/ | */ | ||||
public void removeContentType(PackagePartName partName) | public void removeContentType(PackagePartName partName) | ||||
* content type) or the extension (in case of default content type), | * content type) or the extension (in case of default content type), | ||||
* else <code>null</code>. | * else <code>null</code>. | ||||
* | * | ||||
* @exception OpenXML4JRuntimeException | |||||
* @throws OpenXML4JRuntimeException | |||||
* Throws if the content type manager is not able to find the | * Throws if the content type manager is not able to find the | ||||
* content from an existing part. | * content from an existing part. | ||||
*/ | */ |
* </p> | * </p> | ||||
* @return the value of the cell as a number | * @return the value of the cell as a number | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING | ||||
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @throws NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @see org.apache.poi.ss.usermodel.DataFormatter for turning this number into a string similar to that which Excel would render this number as. | * @see org.apache.poi.ss.usermodel.DataFormatter for turning this number into a string similar to that which Excel would render this number as. | ||||
*/ | */ | ||||
@Override | @Override | ||||
* </p> | * </p> | ||||
* @return the value of the cell as a date | * @return the value of the cell as a date | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING | ||||
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @throws NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @see org.apache.poi.ss.usermodel.DataFormatter for formatting this date into a string similar to how excel does. | * @see org.apache.poi.ss.usermodel.DataFormatter for formatting this date into a string similar to how excel does. | ||||
*/ | */ | ||||
@Override | @Override | ||||
* </p> | * </p> | ||||
* @return the value of the cell as a date | * @return the value of the cell as a date | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING | ||||
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @throws NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @see org.apache.poi.ss.usermodel.DataFormatter for formatting this date into a string similar to how excel does. | * @see org.apache.poi.ss.usermodel.DataFormatter for formatting this date into a string similar to how excel does. | ||||
*/ | */ | ||||
@Override | @Override |
* Write out this workbook to an OutputStream. | * Write out this workbook to an OutputStream. | ||||
* | * | ||||
* @param stream - the java OutputStream you wish to write to | * @param stream - the java OutputStream you wish to write to | ||||
* @exception IOException if anything can't be written. | |||||
* @throws IOException if anything can't be written. | |||||
*/ | */ | ||||
@Override | @Override | ||||
public void write(OutputStream stream) throws IOException { | public void write(OutputStream stream) throws IOException { | ||||
* so using this does not guarantee that there will be no temp file usage. | * so using this does not guarantee that there will be no temp file usage. | ||||
* | * | ||||
* @param stream - the java OutputStream you wish to write to | * @param stream - the java OutputStream you wish to write to | ||||
* @exception IOException if anything can't be written. | |||||
* @throws IOException if anything can't be written. | |||||
* @since POI 5.1.0 (experimental and still liable to change or be removed) | * @since POI 5.1.0 (experimental and still liable to change or be removed) | ||||
*/ | */ | ||||
@Beta | @Beta |
* </p> | * </p> | ||||
* @return the value of the cell as a number | * @return the value of the cell as a number | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | ||||
* @exception NumberFormatException if the cell value isn't a parsable {@code double}. | |||||
* @throws NumberFormatException if the cell value isn't a parsable {@code double}. | |||||
* @see DataFormatter for turning this number into a string similar to that which Excel would render this number as. | * @see DataFormatter for turning this number into a string similar to that which Excel would render this number as. | ||||
*/ | */ | ||||
@Override | @Override | ||||
* </p> | * </p> | ||||
* @return the value of the cell as a date | * @return the value of the cell as a date | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | ||||
* @exception NumberFormatException if the cell value isn't a parsable {@code double}. | |||||
* @throws NumberFormatException if the cell value isn't a parsable {@code double}. | |||||
* @see DataFormatter for formatting this date into a string similar to how excel does. | * @see DataFormatter for formatting this date into a string similar to how excel does. | ||||
*/ | */ | ||||
@Override | @Override | ||||
* </p> | * </p> | ||||
* @return the value of the cell as a LocalDateTime | * @return the value of the cell as a LocalDateTime | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | ||||
* @exception NumberFormatException if the cell value isn't a parsable {@code double}. | |||||
* @throws NumberFormatException if the cell value isn't a parsable {@code double}. | |||||
* @see DataFormatter for formatting this date into a string similar to how excel does. | * @see DataFormatter for formatting this date into a string similar to how excel does. | ||||
*/ | */ | ||||
@Override | @Override |
private final List<TNEFAttribute> messageAttributes = new ArrayList<>(); | private final List<TNEFAttribute> messageAttributes = new ArrayList<>(); | ||||
private final List<MAPIAttribute> mapiAttributes = new ArrayList<>(); | private final List<MAPIAttribute> mapiAttributes = new ArrayList<>(); | ||||
private final List<Attachment> attachments = new ArrayList<>(); | private final List<Attachment> attachments = new ArrayList<>(); | ||||
/** | |||||
* @param inp input stream | |||||
* @throws IOException | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | |||||
public HMEFMessage(InputStream inp) throws IOException { | public HMEFMessage(InputStream inp) throws IOException { | ||||
try { | try { | ||||
// Check the signature matches | // Check the signature matches |
/** | /** | ||||
* Constructs a Powerpoint document from an input stream. | * Constructs a Powerpoint document from an input stream. | ||||
* @throws IOException | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
@SuppressWarnings("resource") | @SuppressWarnings("resource") | ||||
public HSLFSlideShow(InputStream inputStream) throws IOException { | public HSLFSlideShow(InputStream inputStream) throws IOException { | ||||
/** | /** | ||||
* Constructs a Powerpoint document from an POIFSFileSystem. | * Constructs a Powerpoint document from an POIFSFileSystem. | ||||
* @throws IOException | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
@SuppressWarnings("resource") | @SuppressWarnings("resource") | ||||
public HSLFSlideShow(POIFSFileSystem poifs) throws IOException { | public HSLFSlideShow(POIFSFileSystem poifs) throws IOException { | ||||
/** | /** | ||||
* Constructs a Powerpoint document from an DirectoryNode. | * Constructs a Powerpoint document from an DirectoryNode. | ||||
* @throws IOException | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
@SuppressWarnings("resource") | @SuppressWarnings("resource") | ||||
public HSLFSlideShow(DirectoryNode root) throws IOException { | public HSLFSlideShow(DirectoryNode root) throws IOException { |
* Constructor for reading MSG Files from the file system. | * Constructor for reading MSG Files from the file system. | ||||
* | * | ||||
* @param filename Name of the file to read | * @param filename Name of the file to read | ||||
* @exception IOException on errors reading, or invalid data | |||||
* @throws IOException on errors reading, or invalid data | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public MAPIMessage(String filename) throws IOException { | public MAPIMessage(String filename) throws IOException { | ||||
this(new File(filename)); | this(new File(filename)); | ||||
* Constructor for reading MSG Files from the file system. | * Constructor for reading MSG Files from the file system. | ||||
* | * | ||||
* @param file The file to read from | * @param file The file to read from | ||||
* @exception IOException on errors reading, or invalid data | |||||
* @throws IOException on errors reading, or invalid data | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public MAPIMessage(File file) throws IOException { | public MAPIMessage(File file) throws IOException { | ||||
this(new POIFSFileSystem(file)); | this(new POIFSFileSystem(file)); | ||||
* <p>Note - this will buffer the whole message into memory | * <p>Note - this will buffer the whole message into memory | ||||
* in order to process. For lower memory use, use {@link #MAPIMessage(File)} | * in order to process. For lower memory use, use {@link #MAPIMessage(File)} | ||||
* | * | ||||
* @param in The InputStream to buffer then read from | |||||
* @exception IOException on errors reading, or invalid data | |||||
* @param in The InputStream to buffer and then read from | |||||
* @throws IOException on errors reading, or invalid data | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public MAPIMessage(InputStream in) throws IOException { | public MAPIMessage(InputStream in) throws IOException { | ||||
this(new POIFSFileSystem(in)); | this(new POIFSFileSystem(in)); | ||||
* Constructor for reading MSG Files from a POIFS filesystem | * Constructor for reading MSG Files from a POIFS filesystem | ||||
* | * | ||||
* @param fs Open POIFS FileSystem containing the message | * @param fs Open POIFS FileSystem containing the message | ||||
* @exception IOException on errors reading, or invalid data | |||||
* @throws IOException on errors reading, or invalid data | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public MAPIMessage(POIFSFileSystem fs) throws IOException { | public MAPIMessage(POIFSFileSystem fs) throws IOException { | ||||
this(fs.getRoot()); | this(fs.getRoot()); | ||||
* Constructor for reading MSG Files from a certain | * Constructor for reading MSG Files from a certain | ||||
* point within a POIFS filesystem | * point within a POIFS filesystem | ||||
* @param poifsDir Directory containing the message | * @param poifsDir Directory containing the message | ||||
* @exception IOException on errors reading, or invalid data | |||||
* @throws IOException on errors reading, or invalid data | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public MAPIMessage(DirectoryNode poifsDir) throws IOException { | public MAPIMessage(DirectoryNode poifsDir) throws IOException { | ||||
super(poifsDir); | super(poifsDir); |
* @return DOM representation of result HTML | * @return DOM representation of result HTML | ||||
* @throws IOException If an error occurs reading or writing files | * @throws IOException If an error occurs reading or writing files | ||||
* @throws ParserConfigurationException If configuration is incorrect | * @throws ParserConfigurationException If configuration is incorrect | ||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public static Document process(File xlsFile) throws IOException, ParserConfigurationException { | public static Document process(File xlsFile) throws IOException, ParserConfigurationException { | ||||
try (HSSFWorkbook workbook = loadXls(xlsFile)) { | try (HSSFWorkbook workbook = loadXls(xlsFile)) { | ||||
* @return DOM representation of result HTML | * @return DOM representation of result HTML | ||||
* @throws IOException If an error occurs reading or writing files | * @throws IOException If an error occurs reading or writing files | ||||
* @throws ParserConfigurationException If configuration is incorrect | * @throws ParserConfigurationException If configuration is incorrect | ||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public static Document process(InputStream xlsStream) throws IOException, ParserConfigurationException { | public static Document process(InputStream xlsStream) throws IOException, ParserConfigurationException { | ||||
try (HSSFWorkbook workbook = new HSSFWorkbook(xlsStream)) { | try (HSSFWorkbook workbook = new HSSFWorkbook(xlsStream)) { | ||||
* @return DOM representation of result HTML | * @return DOM representation of result HTML | ||||
* @throws IOException If an error occurs reading or writing files | * @throws IOException If an error occurs reading or writing files | ||||
* @throws ParserConfigurationException If configuration is incorrect | * @throws ParserConfigurationException If configuration is incorrect | ||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public static Document process(HSSFWorkbook workbook) throws IOException, ParserConfigurationException { | public static Document process(HSSFWorkbook workbook) throws IOException, ParserConfigurationException { | ||||
ExcelToHtmlConverter excelToHtmlConverter = new ExcelToHtmlConverter( | ExcelToHtmlConverter excelToHtmlConverter = new ExcelToHtmlConverter( |
return MAX_RECORD_LENGTH; | return MAX_RECORD_LENGTH; | ||||
} | } | ||||
/** | |||||
* @param inputStream | |||||
* @throws IOException | |||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | |||||
public HwmfPicture(InputStream inputStream) throws IOException { | public HwmfPicture(InputStream inputStream) throws IOException { | ||||
try (LittleEndianInputStream leis = new LittleEndianInputStream(inputStream)) { | try (LittleEndianInputStream leis = new LittleEndianInputStream(inputStream)) { |
* @throws IOException If there is an unexpected IOException from the passed | * @throws IOException If there is an unexpected IOException from the passed | ||||
* in InputStream. | * in InputStream. | ||||
* @throws org.apache.poi.EmptyFileException If the given stream is empty | * @throws org.apache.poi.EmptyFileException If the given stream is empty | ||||
* @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public HWPFDocument(InputStream istream) throws IOException { | public HWPFDocument(InputStream istream) throws IOException { | ||||
//do Ole stuff | //do Ole stuff | ||||
* @param pfilesystem The POIFSFileSystem that contains the Word document. | * @param pfilesystem The POIFSFileSystem that contains the Word document. | ||||
* @throws IOException If there is an unexpected IOException from the passed | * @throws IOException If there is an unexpected IOException from the passed | ||||
* in POIFSFileSystem. | * in POIFSFileSystem. | ||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public HWPFDocument(POIFSFileSystem pfilesystem) throws IOException { | public HWPFDocument(POIFSFileSystem pfilesystem) throws IOException { | ||||
this(pfilesystem.getRoot()); | this(pfilesystem.getRoot()); | ||||
* @param directory The DirectoryNode that contains the Word document. | * @param directory The DirectoryNode that contains the Word document. | ||||
* @throws IOException If there is an unexpected IOException from the passed | * @throws IOException If there is an unexpected IOException from the passed | ||||
* in POIFSFileSystem. | * in POIFSFileSystem. | ||||
* @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the | |||||
* input format | |||||
*/ | */ | ||||
public HWPFDocument(DirectoryNode directory) throws IOException { | public HWPFDocument(DirectoryNode directory) throws IOException { | ||||
// Load the main stream and FIB | // Load the main stream and FIB |
* | * | ||||
* @param offset The offset within the {@code dst} byte array. | * @param offset The offset within the {@code dst} byte array. | ||||
* | * | ||||
* @exception ArrayStoreException if there is not enough room for the class | |||||
* @throws ArrayStoreException if there is not enough room for the class | |||||
* ID 16 bytes in the byte array after the {@code offset} position. | * ID 16 bytes in the byte array after the {@code offset} position. | ||||
*/ | */ | ||||
@SuppressWarnings("PointlessArithmeticExpression") | @SuppressWarnings("PointlessArithmeticExpression") |
* stream. | * stream. | ||||
* @throws IOException | * @throws IOException | ||||
* if the {@link InputStream} cannot be accessed as needed. | * if the {@link InputStream} cannot be accessed as needed. | ||||
* @exception NoPropertySetStreamException | |||||
* @throws NoPropertySetStreamException | |||||
* if the input stream does not contain a property set. | * if the input stream does not contain a property set. | ||||
*/ | */ | ||||
public DocumentSummaryInformation(final InputStream stream) | public DocumentSummaryInformation(final InputStream stream) |
* @param length The property's type/value pair's length in bytes. | * @param length The property's type/value pair's length in bytes. | ||||
* @param codepage The section's and thus the property's | * @param codepage The section's and thus the property's | ||||
* codepage. It is needed only when reading string values. | * codepage. It is needed only when reading string values. | ||||
* @exception UnsupportedEncodingException if the specified codepage is not | |||||
* @throws UnsupportedEncodingException if the specified codepage is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
public Property(final long id, final byte[] src, final long offset, final int length, final int codepage) | public Property(final long id, final byte[] src, final long offset, final int length, final int codepage) | ||||
* @param length The property's type/value pair's length in bytes. | * @param length The property's type/value pair's length in bytes. | ||||
* @param codepage The section's and thus the property's | * @param codepage The section's and thus the property's | ||||
* codepage. It is needed only when reading string values. | * codepage. It is needed only when reading string values. | ||||
* @exception UnsupportedEncodingException if the specified codepage is not | |||||
* @throws UnsupportedEncodingException if the specified codepage is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
public Property(final long id, LittleEndianByteArrayInputStream leis, final int length, final int codepage) | public Property(final long id, LittleEndianByteArrayInputStream leis, final int length, final int codepage) | ||||
* | * | ||||
* @return the property's size in bytes | * @return the property's size in bytes | ||||
* | * | ||||
* @exception WritingNotSupportedException if HPSF does not yet support the | |||||
* @throws WritingNotSupportedException if HPSF does not yet support the | |||||
* property's variant type. | * property's variant type. | ||||
*/ | */ | ||||
protected int getSize(int property) throws WritingNotSupportedException | protected int getSize(int property) throws WritingNotSupportedException | ||||
* @param codepage The codepage to use for writing non-wide strings | * @param codepage The codepage to use for writing non-wide strings | ||||
* @return the number of bytes written to the stream | * @return the number of bytes written to the stream | ||||
* | * | ||||
* @exception IOException if an I/O error occurs | |||||
* @exception WritingNotSupportedException if a variant type is to be | |||||
* @throws IOException if an I/O error occurs | |||||
* @throws WritingNotSupportedException if a variant type is to be | |||||
* written that is not yet supported | * written that is not yet supported | ||||
*/ | */ | ||||
public int write(final OutputStream out, final int codepage) | public int write(final OutputStream out, final int codepage) |
* stream. | * stream. | ||||
* @throws IOException | * @throws IOException | ||||
* if the {@link InputStream} cannot be accessed as needed. | * if the {@link InputStream} cannot be accessed as needed. | ||||
* @exception NoPropertySetStreamException | |||||
* @throws NoPropertySetStreamException | |||||
* if the input stream does not contain a property set. | * if the input stream does not contain a property set. | ||||
* @exception UnsupportedEncodingException | |||||
* @throws UnsupportedEncodingException | |||||
* if a character encoding is not supported. | * if a character encoding is not supported. | ||||
*/ | */ | ||||
public PropertySet(final InputStream stream) | public PropertySet(final InputStream stream) | ||||
* @throws NoPropertySetStreamException if the byte array is not a | * @throws NoPropertySetStreamException if the byte array is not a | ||||
* property set stream. | * property set stream. | ||||
* | * | ||||
* @exception UnsupportedEncodingException if the codepage is not supported. | |||||
* @throws UnsupportedEncodingException if the codepage is not supported. | |||||
*/ | */ | ||||
public PropertySet(final byte[] stream, final int offset, final int length) | public PropertySet(final byte[] stream, final int offset, final int length) | ||||
throws NoPropertySetStreamException, UnsupportedEncodingException { | throws NoPropertySetStreamException, UnsupportedEncodingException { | ||||
* @throws NoPropertySetStreamException if the byte array is not a | * @throws NoPropertySetStreamException if the byte array is not a | ||||
* property set stream. | * property set stream. | ||||
* | * | ||||
* @exception UnsupportedEncodingException if the codepage is not supported. | |||||
* @throws UnsupportedEncodingException if the codepage is not supported. | |||||
*/ | */ | ||||
public PropertySet(final byte[] stream) | public PropertySet(final byte[] stream) | ||||
throws NoPropertySetStreamException, UnsupportedEncodingException { | throws NoPropertySetStreamException, UnsupportedEncodingException { | ||||
* {@link InputStream#mark} method. | * {@link InputStream#mark} method. | ||||
* @return {@code true} if the stream is a property set | * @return {@code true} if the stream is a property set | ||||
* stream, else {@code false}. | * stream, else {@code false}. | ||||
* @exception IOException if an I/O error occurs | |||||
* @throws IOException if an I/O error occurs | |||||
*/ | */ | ||||
public static boolean isPropertySetStream(final InputStream stream) throws IOException { | public static boolean isPropertySetStream(final InputStream stream) throws IOException { | ||||
/* | /* | ||||
* Writes the property set to an output stream. | * Writes the property set to an output stream. | ||||
* | * | ||||
* @param out the output stream to write the section to | * @param out the output stream to write the section to | ||||
* @exception IOException if an error when writing to the output stream | |||||
* @throws IOException if an error when writing to the output stream | |||||
* occurs | * occurs | ||||
* @exception WritingNotSupportedException if HPSF does not yet support | |||||
* @throws WritingNotSupportedException if HPSF does not yet support | |||||
* writing a property's variant type. | * writing a property's variant type. | ||||
*/ | */ | ||||
public void write(final OutputStream out) throws IOException, WritingNotSupportedException { | public void write(final OutputStream out) throws IOException, WritingNotSupportedException { |
* @throws NoPropertySetStreamException if the stream does not | * @throws NoPropertySetStreamException if the stream does not | ||||
* contain a property set. | * contain a property set. | ||||
* @throws IOException if some I/O problem occurs. | * @throws IOException if some I/O problem occurs. | ||||
* @exception UnsupportedEncodingException if the specified codepage is not | |||||
* @throws UnsupportedEncodingException if the specified codepage is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
public static PropertySet create(final DirectoryEntry dir, final String name) | public static PropertySet create(final DirectoryEntry dir, final String name) | ||||
* @throws NoPropertySetStreamException if the stream does not | * @throws NoPropertySetStreamException if the stream does not | ||||
* contain a property set. | * contain a property set. | ||||
* @throws IOException if some I/O problem occurs. | * @throws IOException if some I/O problem occurs. | ||||
* @exception UnsupportedEncodingException if the specified codepage is not | |||||
* @throws UnsupportedEncodingException if the specified codepage is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
public static PropertySet create(final InputStream stream) | public static PropertySet create(final InputStream stream) |
* @param offset The position in the stream that points to the | * @param offset The position in the stream that points to the | ||||
* section's format ID. | * section's format ID. | ||||
* | * | ||||
* @exception UnsupportedEncodingException if the section's codepage is not | |||||
* @throws UnsupportedEncodingException if the section's codepage is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
public Section(final byte[] src, final int offset) throws UnsupportedEncodingException { | public Section(final byte[] src, final int offset) throws UnsupportedEncodingException { | ||||
* @param out The stream to write into. | * @param out The stream to write into. | ||||
* | * | ||||
* @return The number of bytes written, i.e. the section's size. | * @return The number of bytes written, i.e. the section's size. | ||||
* @exception IOException if an I/O error occurs | |||||
* @exception WritingNotSupportedException if HPSF does not yet support | |||||
* @throws IOException if an I/O error occurs | |||||
* @throws WritingNotSupportedException if HPSF does not yet support | |||||
* writing a property's variant type. | * writing a property's variant type. | ||||
*/ | */ | ||||
public int write(final OutputStream out) throws WritingNotSupportedException, IOException { | public int write(final OutputStream out) throws WritingNotSupportedException, IOException { | ||||
* | * | ||||
* @param out The output stream to write to. | * @param out The output stream to write to. | ||||
* @param codepage The codepage to be used to write the dictionary items. | * @param codepage The codepage to be used to write the dictionary items. | ||||
* @exception IOException if an I/O exception occurs. | |||||
* @throws IOException if an I/O exception occurs. | |||||
*/ | */ | ||||
private void writeDictionary(final OutputStream out, final int codepage) | private void writeDictionary(final OutputStream out, final int codepage) | ||||
throws IOException { | throws IOException { | ||||
* | * | ||||
* @param dictionary The dictionary | * @param dictionary The dictionary | ||||
* | * | ||||
* @exception IllegalPropertySetDataException if the dictionary's key and | |||||
* @throws IllegalPropertySetDataException if the dictionary's key and | |||||
* value types are not correct. | * value types are not correct. | ||||
* | * | ||||
* @see Section#getDictionary() | * @see Section#getDictionary() |
* stream. | * stream. | ||||
* @throws IOException | * @throws IOException | ||||
* if the {@link InputStream} cannot be accessed as needed. | * if the {@link InputStream} cannot be accessed as needed. | ||||
* @exception NoPropertySetStreamException | |||||
* @throws NoPropertySetStreamException | |||||
* if the input stream does not contain a property set. | * if the input stream does not contain a property set. | ||||
* @exception UnsupportedEncodingException | |||||
* @throws UnsupportedEncodingException | |||||
* if a character encoding is not supported. | * if a character encoding is not supported. | ||||
*/ | */ | ||||
public SummaryInformation(final InputStream stream) | public SummaryInformation(final InputStream stream) |
* @return A Java object that corresponds best to the variant field. For | * @return A Java object that corresponds best to the variant field. For | ||||
* example, a VT_I4 is returned as a {@link Long}, a VT_LPSTR as a | * example, a VT_I4 is returned as a {@link Long}, a VT_LPSTR as a | ||||
* {@link String}. | * {@link String}. | ||||
* @exception ReadingNotSupportedException if a property is to be written | |||||
* @throws ReadingNotSupportedException if a property is to be written | |||||
* who's variant type HPSF does not yet support | * who's variant type HPSF does not yet support | ||||
* @exception UnsupportedEncodingException if the specified codepage is not | |||||
* @throws UnsupportedEncodingException if the specified codepage is not | |||||
* supported. | * supported. | ||||
* @see Variant | * @see Variant | ||||
*/ | */ | ||||
* @param codepage The codepage to use to write non-wide strings | * @param codepage The codepage to use to write non-wide strings | ||||
* @return The number of entities that have been written. In many cases an | * @return The number of entities that have been written. In many cases an | ||||
* "entity" is a byte but this is not always the case. | * "entity" is a byte but this is not always the case. | ||||
* @exception IOException if an I/O exceptions occurs | |||||
* @exception WritingNotSupportedException if a property is to be written | |||||
* @throws IOException if an I/O exceptions occurs | |||||
* @throws WritingNotSupportedException if a property is to be written | |||||
* who's variant type HPSF does not yet support | * who's variant type HPSF does not yet support | ||||
*/ | */ | ||||
public static int write(final OutputStream out, final long type, | public static int write(final OutputStream out, final long type, |
* @param in the InputStream from which the records will be | * @param in the InputStream from which the records will be | ||||
* obtained | * obtained | ||||
* | * | ||||
* @exception RecordFormatException on error processing the | |||||
* @throws RecordFormatException on error processing the | |||||
* InputStream | * InputStream | ||||
*/ | */ | ||||
public void processRecords(InputStream in) throws RecordFormatException { | public void processRecords(InputStream in) throws RecordFormatException { |
* | * | ||||
* @return an array of Records created from the InputStream | * @return an array of Records created from the InputStream | ||||
* | * | ||||
* @exception org.apache.poi.util.RecordFormatException on error processing the InputStream | |||||
* @throws org.apache.poi.util.RecordFormatException on error processing the InputStream | |||||
*/ | */ | ||||
public static List<org.apache.poi.hssf.record.Record> createRecords(InputStream in) throws RecordFormatException { | public static List<org.apache.poi.hssf.record.Record> createRecords(InputStream in) throws RecordFormatException { | ||||
* | * | ||||
* @param requestedLength the length of the final string | * @param requestedLength the length of the final string | ||||
* @return the converted string | * @return the converted string | ||||
* @exception IllegalArgumentException if len is too large (i.e., | |||||
* @throws IllegalArgumentException if len is too large (i.e., | |||||
* there is not enough data in string to create a String of that | * there is not enough data in string to create a String of that | ||||
* length) | * length) | ||||
*/ | */ |
* | * | ||||
* @param stream the InputStream from which to read the data | * @param stream the InputStream from which to read the data | ||||
* | * | ||||
* @exception IOException on errors reading, or on invalid data | |||||
* @throws IOException on errors reading, or on invalid data | |||||
*/ | */ | ||||
public void read(final InputStream stream) throws IOException { | public void read(final InputStream stream) throws IOException { | ||||
* | * | ||||
* @param poifsFile the file from which to read the data | * @param poifsFile the file from which to read the data | ||||
* | * | ||||
* @exception IOException on errors reading, or on invalid data | |||||
* @throws IOException on errors reading, or on invalid data | |||||
*/ | */ | ||||
public void read(final File poifsFile) throws IOException { | public void read(final File poifsFile) throws IOException { | ||||
try (POIFSFileSystem poifs = new POIFSFileSystem(poifsFile, true)) { | try (POIFSFileSystem poifs = new POIFSFileSystem(poifsFile, true)) { | ||||
* | * | ||||
* @param poifs the POIFSFileSystem from which to read the data | * @param poifs the POIFSFileSystem from which to read the data | ||||
* | * | ||||
* @exception IOException on errors reading, or on invalid data | |||||
* @throws IOException on errors reading, or on invalid data | |||||
*/ | */ | ||||
public void read(final POIFSFileSystem poifs) throws IOException { | public void read(final POIFSFileSystem poifs) throws IOException { | ||||
registryClosed = true; | registryClosed = true; | ||||
* | * | ||||
* @param listener the listener to be registered | * @param listener the listener to be registered | ||||
* | * | ||||
* @exception NullPointerException if listener is null | |||||
* @exception IllegalStateException if read() has already been | |||||
* @throws NullPointerException if listener is null | |||||
* @throws IllegalStateException if read() has already been | |||||
* called | * called | ||||
*/ | */ | ||||
* @param listener the listener to be registered | * @param listener the listener to be registered | ||||
* @param name the document name | * @param name the document name | ||||
* | * | ||||
* @exception NullPointerException if listener is null or name is | |||||
* @throws NullPointerException if listener is null or name is | |||||
* null or empty | * null or empty | ||||
* @exception IllegalStateException if read() has already been | |||||
* @throws IllegalStateException if read() has already been | |||||
* called | * called | ||||
*/ | */ | ||||
* assumed | * assumed | ||||
* @param name the document name | * @param name the document name | ||||
* | * | ||||
* @exception NullPointerException if listener is null or name is | |||||
* @throws NullPointerException if listener is null or name is | |||||
* null or empty | * null or empty | ||||
* @exception IllegalStateException if read() has already been | |||||
* @throws IllegalStateException if read() has already been | |||||
* called | * called | ||||
*/ | */ | ||||
* | * | ||||
* @param args names of the files | * @param args names of the files | ||||
* | * | ||||
* @exception IOException if the files can't be read or have invalid content | |||||
* @throws IOException if the files can't be read or have invalid content | |||||
*/ | */ | ||||
public static void main(String[] args) throws IOException { | public static void main(String[] args) throws IOException { |
* @return the specified Entry, if it is directly contained in | * @return the specified Entry, if it is directly contained in | ||||
* this DirectoryEntry | * this DirectoryEntry | ||||
* | * | ||||
* @exception FileNotFoundException if no Entry with the specified | |||||
* @throws FileNotFoundException if no Entry with the specified | |||||
* name exists in this DirectoryEntry | * name exists in this DirectoryEntry | ||||
*/ | */ | ||||
* | * | ||||
* @return a newly opened DocumentInputStream | * @return a newly opened DocumentInputStream | ||||
* | * | ||||
* @exception IOException if the document does not exist or the | |||||
* @throws IOException if the document does not exist or the | |||||
* name is that of a DirectoryEntry | * name is that of a DirectoryEntry | ||||
*/ | */ | ||||
public DocumentInputStream createDocumentInputStream( | public DocumentInputStream createDocumentInputStream( | ||||
* | * | ||||
* @return a newly opened DocumentInputStream or DocumentInputStream | * @return a newly opened DocumentInputStream or DocumentInputStream | ||||
* | * | ||||
* @exception IOException if the document does not exist or the | |||||
* @throws IOException if the document does not exist or the | |||||
* name is that of a DirectoryEntry | * name is that of a DirectoryEntry | ||||
*/ | */ | ||||
public DocumentInputStream createDocumentInputStream( | public DocumentInputStream createDocumentInputStream( | ||||
* | * | ||||
* @return the new DocumentEntry | * @return the new DocumentEntry | ||||
* | * | ||||
* @exception IOException if the document can't be created | |||||
* @throws IOException if the document can't be created | |||||
*/ | */ | ||||
DocumentEntry createDocument(final POIFSDocument document) | DocumentEntry createDocument(final POIFSDocument document) | ||||
throws IOException | throws IOException | ||||
* @return the specified Entry, if it is directly contained in | * @return the specified Entry, if it is directly contained in | ||||
* this DirectoryEntry | * this DirectoryEntry | ||||
* | * | ||||
* @exception FileNotFoundException if no Entry with the specified | |||||
* @throws FileNotFoundException if no Entry with the specified | |||||
* name exists in this DirectoryEntry | * name exists in this DirectoryEntry | ||||
*/ | */ | ||||
* | * | ||||
* @return the new DocumentEntry | * @return the new DocumentEntry | ||||
* | * | ||||
* @exception IOException if the document can't be created | |||||
* @throws IOException if the document can't be created | |||||
*/ | */ | ||||
@Override | @Override | ||||
* | * | ||||
* @return the new DocumentEntry | * @return the new DocumentEntry | ||||
* | * | ||||
* @exception IOException if the document can't be created | |||||
* @throws IOException if the document can't be created | |||||
*/ | */ | ||||
@Override | @Override | ||||
* | * | ||||
* @return the new DirectoryEntry | * @return the new DirectoryEntry | ||||
* | * | ||||
* @exception IOException if the directory can't be created | |||||
* @throws IOException if the directory can't be created | |||||
*/ | */ | ||||
@Override | @Override | ||||
* | * | ||||
* @return the new or updated DocumentEntry | * @return the new or updated DocumentEntry | ||||
* | * | ||||
* @exception IOException if the document can't be created or its content be replaced | |||||
* @throws IOException if the document can't be created or its content be replaced | |||||
*/ | */ | ||||
@SuppressWarnings("WeakerAccess") | @SuppressWarnings("WeakerAccess") | ||||
public DocumentEntry createOrUpdateDocument(final String name, | public DocumentEntry createOrUpdateDocument(final String name, |
* | * | ||||
* @param document the DocumentEntry to be read | * @param document the DocumentEntry to be read | ||||
* | * | ||||
* @exception IOException if the DocumentEntry cannot be opened (like, maybe it has | |||||
* @throws IOException if the DocumentEntry cannot be opened (like, maybe it has | |||||
* been deleted?) | * been deleted?) | ||||
*/ | */ | ||||
public DocumentInputStream(DocumentEntry document) throws IOException { | public DocumentInputStream(DocumentEntry document) throws IOException { |
* If the components parameter is null or has zero length, the POIFSDocumentPath is appropriate | * If the components parameter is null or has zero length, the POIFSDocumentPath is appropriate | ||||
* for a document that is in the root of a POIFSFileSystem | * for a document that is in the root of a POIFSFileSystem | ||||
* | * | ||||
* @exception IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* if any of the elements in the components parameter are null or have zero length | * if any of the elements in the components parameter are null or have zero length | ||||
*/ | */ | ||||
public POIFSDocumentPath(final String [] components) throws IllegalArgumentException { | public POIFSDocumentPath(final String [] components) throws IllegalArgumentException { | ||||
* @param path the existing path | * @param path the existing path | ||||
* @param components the additional subdirectory names to be added | * @param components the additional subdirectory names to be added | ||||
* | * | ||||
* @exception IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* if any of the Strings in components is null or zero length | * if any of the Strings in components is null or zero length | ||||
*/ | */ | ||||
public POIFSDocumentPath(final POIFSDocumentPath path, final String[] components) throws IllegalArgumentException { | public POIFSDocumentPath(final POIFSDocumentPath path, final String[] components) throws IllegalArgumentException { | ||||
* | * | ||||
* @return the nth component; | * @return the nth component; | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if n < 0 or n >= length() | |||||
* @throws ArrayIndexOutOfBoundsException if n < 0 or n >= length() | |||||
*/ | */ | ||||
public String getComponent(int n) throws ArrayIndexOutOfBoundsException { | public String getComponent(int n) throws ArrayIndexOutOfBoundsException { | ||||
return components[ n ]; | return components[ n ]; |
* | * | ||||
* @param property the new child to be added; must not be null | * @param property the new child to be added; must not be null | ||||
* | * | ||||
* @exception IOException if we already have a child with the same | |||||
* @throws IOException if we already have a child with the same | |||||
* name | * name | ||||
*/ | */ | ||||
public void addChild(final Property property) | public void addChild(final Property property) |
* | * | ||||
* @param property the new child to be added; must not be null | * @param property the new child to be added; must not be null | ||||
* | * | ||||
* @exception IOException if the Parent already has a child with | |||||
* @throws IOException if the Parent already has a child with | |||||
* the same name | * the same name | ||||
*/ | */ | ||||
* @param stream the OutputStream to which the data should be | * @param stream the OutputStream to which the data should be | ||||
* written. | * written. | ||||
* | * | ||||
* @exception IOException on problems writing to the specified | |||||
* @throws IOException on problems writing to the specified | |||||
* stream. | * stream. | ||||
*/ | */ | ||||
public void writeData(OutputStream stream) | public void writeData(OutputStream stream) |
* @param headerBlock the header block of the file | * @param headerBlock the header block of the file | ||||
* @param filesystem the filesystem to read from | * @param filesystem the filesystem to read from | ||||
* | * | ||||
* @exception IOException if anything goes wrong (which should be | |||||
* @throws IOException if anything goes wrong (which should be | |||||
* a result of the input being NFG) | * a result of the input being NFG) | ||||
*/ | */ | ||||
public PropertyTable(final HeaderBlock headerBlock, final POIFSFileSystem filesystem) | public PropertyTable(final HeaderBlock headerBlock, final POIFSFileSystem filesystem) |
* @param stream the OutputStream to which the stored data should | * @param stream the OutputStream to which the stored data should | ||||
* be written | * be written | ||||
* | * | ||||
* @exception IOException on problems writing to the specified | |||||
* @throws IOException on problems writing to the specified | |||||
* stream | * stream | ||||
*/ | */ | ||||
public void writeBlocks(final OutputStream stream) throws IOException { | public void writeBlocks(final OutputStream stream) throws IOException { |
* @param stream the OutputStream to which the stored data should | * @param stream the OutputStream to which the stored data should | ||||
* be written | * be written | ||||
* | * | ||||
* @exception IOException on problems writing to the specified | |||||
* @throws IOException on problems writing to the specified | |||||
* stream | * stream | ||||
*/ | */ | ||||
* | * | ||||
* @param stream the source InputStream | * @param stream the source InputStream | ||||
* | * | ||||
* @exception IOException on errors or bad data | |||||
* @throws IOException on errors or bad data | |||||
*/ | */ | ||||
public HeaderBlock(InputStream stream) throws IOException { | public HeaderBlock(InputStream stream) throws IOException { | ||||
// Grab the first 512 bytes | // Grab the first 512 bytes | ||||
* @param stream the OutputStream to which the stored data should | * @param stream the OutputStream to which the stored data should | ||||
* be written | * be written | ||||
* | * | ||||
* @exception IOException on problems writing to the specified | |||||
* @throws IOException on problems writing to the specified | |||||
* stream | * stream | ||||
*/ | */ | ||||
public void writeData(final OutputStream stream) throws IOException { | public void writeData(final OutputStream stream) throws IOException { |
* </p> | * </p> | ||||
* @return the value of the cell as a number | * @return the value of the cell as a number | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | ||||
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @throws NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @see DataFormatter for turning this number into a string similar to that which Excel would render this number as. | * @see DataFormatter for turning this number into a string similar to that which Excel would render this number as. | ||||
*/ | */ | ||||
double getNumericCellValue(); | double getNumericCellValue(); | ||||
* </p> | * </p> | ||||
* @return the value of the cell as a date | * @return the value of the cell as a date | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | ||||
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @throws NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @see DataFormatter for formatting this date into a string similar to how excel does. | * @see DataFormatter for formatting this date into a string similar to how excel does. | ||||
*/ | */ | ||||
Date getDateCellValue(); | Date getDateCellValue(); | ||||
* </p> | * </p> | ||||
* @return the value of the cell as a LocalDateTime | * @return the value of the cell as a LocalDateTime | ||||
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} | ||||
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @throws NumberFormatException if the cell value isn't a parsable <code>double</code>. | |||||
* @see DataFormatter for formatting this date into a string similar to how excel does. | * @see DataFormatter for formatting this date into a string similar to how excel does. | ||||
*/ | */ | ||||
LocalDateTime getLocalDateTimeCellValue(); | LocalDateTime getLocalDateTimeCellValue(); |
* | * | ||||
* @return days number of days since 1900/12/31 | * @return days number of days since 1900/12/31 | ||||
* @param cal the Calendar | * @param cal the Calendar | ||||
* @exception IllegalArgumentException if date is invalid | |||||
* @throws IllegalArgumentException if date is invalid | |||||
*/ | */ | ||||
protected static int absoluteDay(Calendar cal, boolean use1904windowing) | protected static int absoluteDay(Calendar cal, boolean use1904windowing) | ||||
{ | { | ||||
* | * | ||||
* @return days number of days since 1900/12/31 | * @return days number of days since 1900/12/31 | ||||
* @param date the Date | * @param date the Date | ||||
* @exception IllegalArgumentException if date is invalid | |||||
* @throws IllegalArgumentException if date is invalid | |||||
*/ | */ | ||||
protected static int absoluteDay(LocalDateTime date, boolean use1904windowing) | protected static int absoluteDay(LocalDateTime date, boolean use1904windowing) | ||||
{ | { | ||||
* @return days number of days since 1900/12/31 | * @return days number of days since 1900/12/31 | ||||
* @param dayOfYear the day of the year | * @param dayOfYear the day of the year | ||||
* @param year the year | * @param year the year | ||||
* @exception IllegalArgumentException if date is invalid | |||||
* @throws IllegalArgumentException if date is invalid | |||||
*/ | */ | ||||
private static int absoluteDay(int year, int dayOfYear, boolean use1904windowing) { | private static int absoluteDay(int year, int dayOfYear, boolean use1904windowing) { | ||||
return dayOfYear + daysInPriorYears(year, use1904windowing); | return dayOfYear + daysInPriorYears(year, use1904windowing); | ||||
* @return days number of days in years prior to yr. | * @return days number of days in years prior to yr. | ||||
* @param yr a year (1900 < yr < 4000) | * @param yr a year (1900 < yr < 4000) | ||||
* @param use1904windowing Should 1900 or 1904 date windowing be used? | * @param use1904windowing Should 1900 or 1904 date windowing be used? | ||||
* @exception IllegalArgumentException if year is outside of range. | |||||
* @throws IllegalArgumentException if year is outside of range. | |||||
*/ | */ | ||||
static int daysInPriorYears(int yr, boolean use1904windowing) | static int daysInPriorYears(int yr, boolean use1904windowing) |
* Write out this workbook to an OutputStream. | * Write out this workbook to an OutputStream. | ||||
* | * | ||||
* @param stream - the java OutputStream you wish to write to | * @param stream - the java OutputStream you wish to write to | ||||
* @exception IOException if anything can't be written. | |||||
* @throws IOException if anything can't be written. | |||||
*/ | */ | ||||
void write(OutputStream stream) throws IOException; | void write(OutputStream stream) throws IOException; | ||||
* | * | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public ByteField(final int offset) | public ByteField(final int offset) | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param value the initial value | * @param value the initial value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public ByteField(final int offset, final byte value) | public ByteField(final int offset, final byte value) | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param data the byte array to read the value from | * @param data the byte array to read the value from | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is not | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is not | |||||
* within the range of 0..(data.length - 1) | * within the range of 0..(data.length - 1) | ||||
*/ | */ | ||||
* @param value the initial value | * @param value the initial value | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is not | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is not | |||||
* within the range of 0..(data.length - 1) | * within the range of 0..(data.length - 1) | ||||
*/ | */ | ||||
* @param value to be set | * @param value to be set | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of the byte array's range | * of the byte array's range | ||||
*/ | */ | ||||
* | * | ||||
* @param data the byte array from which the value is to be read | * @param data the byte array from which the value is to be read | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range of the bte array | * of range of the bte array | ||||
*/ | */ | ||||
* @param stream the InputStream from which the value is to be | * @param stream the InputStream from which the value is to be | ||||
* read | * read | ||||
* | * | ||||
* @exception BufferUnderrunException if there is not enough data | |||||
* @throws BufferUnderrunException if there is not enough data | |||||
* available from the InputStream | * available from the InputStream | ||||
* @exception IOException if an IOException is thrown from reading | |||||
* @throws IOException if an IOException is thrown from reading | |||||
* the InputStream | * the InputStream | ||||
*/ | */ | ||||
* @param data the array of bytes to which the value is to be | * @param data the array of bytes to which the value is to be | ||||
* written | * written | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of the byte array's range | * of the byte array's range | ||||
*/ | */ | ||||
* eg "windows-1251", or "cp" followed by the number, e.g. if the codepage | * eg "windows-1251", or "cp" followed by the number, e.g. if the codepage | ||||
* number is 1252 the returned character encoding name will be "cp1252". | * number is 1252 the returned character encoding name will be "cp1252". | ||||
* | * | ||||
* @exception UnsupportedEncodingException if the specified codepage is | |||||
* @throws UnsupportedEncodingException if the specified codepage is | |||||
* less than zero. | * less than zero. | ||||
*/ | */ | ||||
public static String codepageToEncoding(final int codepage) | public static String codepageToEncoding(final int codepage) | ||||
* | * | ||||
* @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a> | * @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a> | ||||
* | * | ||||
* @exception UnsupportedEncodingException if the specified codepage is | |||||
* @throws UnsupportedEncodingException if the specified codepage is | |||||
* less than zero. | * less than zero. | ||||
*/ | */ | ||||
public static String codepageToEncoding(final int codepage, boolean javaLangFormat) | public static String codepageToEncoding(final int codepage, boolean javaLangFormat) |
* | * | ||||
* @param data the byte array from which the value is to be read | * @param data the byte array from which the value is to be read | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of the array's valid index range | * of the array's valid index range | ||||
*/ | */ | ||||
* @param stream the InputStream from which the value is to be | * @param stream the InputStream from which the value is to be | ||||
* read | * read | ||||
* | * | ||||
* @exception BufferUnderrunException if there is not enough data | |||||
* @throws BufferUnderrunException if there is not enough data | |||||
* available from the InputStream | * available from the InputStream | ||||
* @exception IOException if an IOException is thrown from reading | |||||
* @throws IOException if an IOException is thrown from reading | |||||
* the InputStream | * the InputStream | ||||
*/ | */ | ||||
* @param data the array of bytes to which the value is to be | * @param data the array of bytes to which the value is to be | ||||
* written | * written | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of the array's valid index range | * of the array's valid index range | ||||
*/ | */ | ||||
* @param index initial index into the byte array | * @param index initial index into the byte array | ||||
* @param length number of characters to output | * @param length number of characters to output | ||||
* | * | ||||
* @exception IOException is thrown if anything goes wrong writing | |||||
* @throws IOException is thrown if anything goes wrong writing | |||||
* the data to stream | * the data to stream | ||||
* @exception ArrayIndexOutOfBoundsException if the index is | |||||
* @throws ArrayIndexOutOfBoundsException if the index is | |||||
* outside the data array's bounds | * outside the data array's bounds | ||||
* @exception IllegalArgumentException if the output stream is | |||||
* @throws IllegalArgumentException if the output stream is | |||||
* null | * null | ||||
*/ | */ | ||||
public static void dump(final byte [] data, final long offset, | public static void dump(final byte [] data, final long offset, | ||||
* written | * written | ||||
* @param index initial index into the byte array | * @param index initial index into the byte array | ||||
* | * | ||||
* @exception IOException is thrown if anything goes wrong writing | |||||
* @throws IOException is thrown if anything goes wrong writing | |||||
* the data to stream | * the data to stream | ||||
* @exception ArrayIndexOutOfBoundsException if the index is | |||||
* @throws ArrayIndexOutOfBoundsException if the index is | |||||
* outside the data array's bounds | * outside the data array's bounds | ||||
* @exception IllegalArgumentException if the output stream is | |||||
* @throws IllegalArgumentException if the output stream is | |||||
* null | * null | ||||
*/ | */ | ||||
* @param offset its offset, whatever that might mean | * @param offset its offset, whatever that might mean | ||||
* @param index initial index into the byte array | * @param index initial index into the byte array | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the index is | |||||
* @throws ArrayIndexOutOfBoundsException if the index is | |||||
* outside the data array's bounds | * outside the data array's bounds | ||||
* @return output string | * @return output string | ||||
*/ | */ | ||||
* @param index initial index into the byte array | * @param index initial index into the byte array | ||||
* @param length number of characters to output | * @param length number of characters to output | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the index is | |||||
* @throws ArrayIndexOutOfBoundsException if the index is | |||||
* outside the data array's bounds | * outside the data array's bounds | ||||
* @return output string | * @return output string | ||||
*/ | */ |
* @param index the index where the new value is to be added | * @param index the index where the new value is to be added | ||||
* @param value the new value | * @param value the new value | ||||
* | * | ||||
* @exception IndexOutOfBoundsException if the index is out of | |||||
* @throws IndexOutOfBoundsException if the index is out of | |||||
* range (index < 0 || index > size()). | * range (index < 0 || index > size()). | ||||
*/ | */ | ||||
* | * | ||||
* @return true if this list changed as a result of the call. | * @return true if this list changed as a result of the call. | ||||
* | * | ||||
* @exception IndexOutOfBoundsException if the index is out of | |||||
* @throws IndexOutOfBoundsException if the index is out of | |||||
* range (index < 0 || index > size()) | * range (index < 0 || index > size()) | ||||
*/ | */ | ||||
* | * | ||||
* @return the element at the specified position in this list. | * @return the element at the specified position in this list. | ||||
* | * | ||||
* @exception IndexOutOfBoundsException if the index is out of | |||||
* @throws IndexOutOfBoundsException if the index is out of | |||||
* range (index < 0 || index >= size()). | * range (index < 0 || index >= size()). | ||||
*/ | */ | ||||
* | * | ||||
* @return the element previously at the specified position. | * @return the element previously at the specified position. | ||||
* | * | ||||
* @exception IndexOutOfBoundsException if the index is out of | |||||
* @throws IndexOutOfBoundsException if the index is out of | |||||
* range (index < 0 || index >= size()). | * range (index < 0 || index >= size()). | ||||
*/ | */ | ||||
* | * | ||||
* @return the element previously at the specified position. | * @return the element previously at the specified position. | ||||
* | * | ||||
* @exception IndexOutOfBoundsException if the index is out of | |||||
* @throws IndexOutOfBoundsException if the index is out of | |||||
* range (index < 0 || index >= size()). | * range (index < 0 || index >= size()). | ||||
*/ | */ | ||||
* | * | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is | |||||
* negative | * negative | ||||
*/ | */ | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param value the initial value | * @param value the initial value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is | |||||
* negative | * negative | ||||
*/ | */ | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param data the byte array to read the value from | * @param data the byte array to read the value from | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is not | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is not | |||||
* within the range of 0..(data.length - 1) | * within the range of 0..(data.length - 1) | ||||
*/ | */ | ||||
* @param value the initial value | * @param value the initial value | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is | |||||
* negative or too large | * negative or too large | ||||
*/ | */ | ||||
* @param value to be set | * @param value to be set | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is too | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is too | |||||
* large | * large | ||||
*/ | */ | ||||
* | * | ||||
* @param data the byte array from which the value is to be read | * @param data the byte array from which the value is to be read | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is too | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is too | |||||
* large | * large | ||||
*/ | */ | ||||
* @param stream the InputStream from which the value is to be | * @param stream the InputStream from which the value is to be | ||||
* read | * read | ||||
* | * | ||||
* @exception BufferUnderrunException if there is not enough data | |||||
* @throws BufferUnderrunException if there is not enough data | |||||
* available from the InputStream | * available from the InputStream | ||||
* @exception IOException if an IOException is thrown from reading | |||||
* @throws IOException if an IOException is thrown from reading | |||||
* the InputStream | * the InputStream | ||||
*/ | */ | ||||
* @param data the array of bytes to which the value is to be | * @param data the array of bytes to which the value is to be | ||||
* written | * written | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is too | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is too | |||||
* large | * large | ||||
*/ | */ | ||||
* @param value | * @param value | ||||
* the short (16-bit) value | * the short (16-bit) value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException | |||||
* @throws ArrayIndexOutOfBoundsException | |||||
* may be thrown | * may be thrown | ||||
*/ | */ | ||||
public static void putUByte( byte[] data, int offset, short value ) { | public static void putUByte( byte[] data, int offset, short value ) { | ||||
* @param value | * @param value | ||||
* the int (32-bit) value | * the int (32-bit) value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException | |||||
* @throws ArrayIndexOutOfBoundsException | |||||
* may be thrown | * may be thrown | ||||
*/ | */ | ||||
public static void putUInt( byte[] data, int offset, long value ) { | public static void putUInt( byte[] data, int offset, long value ) { | ||||
* @param value | * @param value | ||||
* the short (16-bit) value | * the short (16-bit) value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException | |||||
* @throws ArrayIndexOutOfBoundsException | |||||
* may be thrown | * may be thrown | ||||
*/ | */ | ||||
public static void putUShort( byte[] data, int offset, int value ) { | public static void putUShort( byte[] data, int offset, int value ) { | ||||
* @param stream | * @param stream | ||||
* the InputStream from which the int is to be read | * the InputStream from which the int is to be read | ||||
* @return the int (32-bit) value | * @return the int (32-bit) value | ||||
* @exception IOException | |||||
* @throws IOException | |||||
* will be propagated back to the caller | * will be propagated back to the caller | ||||
* @exception BufferUnderrunException | |||||
* @throws BufferUnderrunException | |||||
* if the stream cannot provide enough bytes | * if the stream cannot provide enough bytes | ||||
*/ | */ | ||||
public static int readInt( InputStream stream ) throws IOException { | public static int readInt( InputStream stream ) throws IOException { | ||||
* @param stream | * @param stream | ||||
* the InputStream from which the int is to be read | * the InputStream from which the int is to be read | ||||
* @return the unsigned int (32-bit) value | * @return the unsigned int (32-bit) value | ||||
* @exception IOException | |||||
* @throws IOException | |||||
* will be propagated back to the caller | * will be propagated back to the caller | ||||
* @exception BufferUnderrunException | |||||
* @throws BufferUnderrunException | |||||
* if the stream cannot provide enough bytes | * if the stream cannot provide enough bytes | ||||
*/ | */ | ||||
public static long readUInt( InputStream stream ) throws IOException { | public static long readUInt( InputStream stream ) throws IOException { | ||||
* @param stream | * @param stream | ||||
* the InputStream from which the long is to be read | * the InputStream from which the long is to be read | ||||
* @return the long (64-bit) value | * @return the long (64-bit) value | ||||
* @exception IOException | |||||
* @throws IOException | |||||
* will be propagated back to the caller | * will be propagated back to the caller | ||||
* @exception BufferUnderrunException | |||||
* @throws BufferUnderrunException | |||||
* if the stream cannot provide enough bytes | * if the stream cannot provide enough bytes | ||||
*/ | */ | ||||
public static long readLong( InputStream stream ) throws IOException { | public static long readLong( InputStream stream ) throws IOException { | ||||
* @param stream | * @param stream | ||||
* the InputStream from which the short is to be read | * the InputStream from which the short is to be read | ||||
* @return the short (16-bit) value | * @return the short (16-bit) value | ||||
* @exception IOException | |||||
* @throws IOException | |||||
* will be propagated back to the caller | * will be propagated back to the caller | ||||
* @exception BufferUnderrunException | |||||
* @throws BufferUnderrunException | |||||
* if the stream cannot provide enough bytes | * if the stream cannot provide enough bytes | ||||
*/ | */ | ||||
public static short readShort( InputStream stream ) throws IOException { | public static short readShort( InputStream stream ) throws IOException { |
* get an unsigned int value from an InputStream | * get an unsigned int value from an InputStream | ||||
* | * | ||||
* @return the unsigned int (32-bit) value | * @return the unsigned int (32-bit) value | ||||
* @exception RuntimeException | |||||
* @throws RuntimeException | |||||
* wraps any IOException thrown from reading the stream. | * wraps any IOException thrown from reading the stream. | ||||
*/ | */ | ||||
//@Override | //@Override |
* | * | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public LongField(final int offset) | public LongField(final int offset) | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param value the initial value | * @param value the initial value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public LongField(final int offset, final long value) | public LongField(final int offset, final long value) | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param data the byte array to read the value from | * @param data the byte array to read the value from | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is not | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is not | |||||
* within the range of 0..(data.length - 1) | * within the range of 0..(data.length - 1) | ||||
*/ | */ | ||||
* @param value the initial value | * @param value the initial value | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public LongField(final int offset, final long value, final byte [] data) | public LongField(final int offset, final long value, final byte [] data) | ||||
* @param value to be set | * @param value to be set | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range | * of range | ||||
*/ | */ | ||||
* | * | ||||
* @param data the byte array from which the value is to be read | * @param data the byte array from which the value is to be read | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range | * of range | ||||
*/ | */ | ||||
* @param stream the InputStream from which the value is to be | * @param stream the InputStream from which the value is to be | ||||
* read | * read | ||||
* | * | ||||
* @exception BufferUnderrunException if there is not enough data | |||||
* @throws BufferUnderrunException if there is not enough data | |||||
* available from the InputStream | * available from the InputStream | ||||
* @exception IOException if an IOException is thrown from reading | |||||
* @throws IOException if an IOException is thrown from reading | |||||
* the InputStream | * the InputStream | ||||
*/ | */ | ||||
* @param data the array of bytes to which the value is to be | * @param data the array of bytes to which the value is to be | ||||
* written | * written | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range | * of range | ||||
*/ | */ | ||||
* | * | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public ShortField(final int offset) | public ShortField(final int offset) | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param value the initial value | * @param value the initial value | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public ShortField(final int offset, final short value) | public ShortField(final int offset, final short value) | ||||
* @param offset of the field within its byte array | * @param offset of the field within its byte array | ||||
* @param data the byte array to read the value from | * @param data the byte array to read the value from | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is not | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is not | |||||
* within the range of 0..(data.length - 1) | * within the range of 0..(data.length - 1) | ||||
*/ | */ | ||||
* @param value the initial value | * @param value the initial value | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if offset is negative | |||||
* @throws ArrayIndexOutOfBoundsException if offset is negative | |||||
*/ | */ | ||||
public ShortField(final int offset, final short value, final byte [] data) | public ShortField(final int offset, final short value, final byte [] data) | ||||
* @param value to be set | * @param value to be set | ||||
* @param data the byte array to write the value to | * @param data the byte array to write the value to | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range | * of range | ||||
*/ | */ | ||||
* | * | ||||
* @param data the byte array from which the value is to be read | * @param data the byte array from which the value is to be read | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range | * of range | ||||
*/ | */ | ||||
* @param stream the InputStream from which the value is to be | * @param stream the InputStream from which the value is to be | ||||
* read | * read | ||||
* | * | ||||
* @exception BufferUnderrunException if there is not enough data | |||||
* @throws BufferUnderrunException if there is not enough data | |||||
* available from the InputStream | * available from the InputStream | ||||
* @exception IOException if an IOException is thrown from reading | |||||
* @throws IOException if an IOException is thrown from reading | |||||
* the InputStream | * the InputStream | ||||
*/ | */ | ||||
* @param data the array of bytes to which the value is to be | * @param data the array of bytes to which the value is to be | ||||
* written | * written | ||||
* | * | ||||
* @exception ArrayIndexOutOfBoundsException if the offset is out | |||||
* @throws ArrayIndexOutOfBoundsException if the offset is out | |||||
* of range | * of range | ||||
*/ | */ | ||||
/** | /** | ||||
* <p>Read a the test file from the "data" directory.</p> | * <p>Read a the test file from the "data" directory.</p> | ||||
* | * | ||||
* @exception FileNotFoundException if the file to be read does not exist. | |||||
* @exception IOException if any other I/O exception occurs. | |||||
* @throws FileNotFoundException if the file to be read does not exist. | |||||
* @throws IOException if any other I/O exception occurs. | |||||
*/ | */ | ||||
@BeforeEach | @BeforeEach | ||||
void setUp() throws IOException { | void setUp() throws IOException { | ||||
* NoPropertySetStreamException} will be thrown when trying to | * NoPropertySetStreamException} will be thrown when trying to | ||||
* create a {@link PropertySet}.</p> | * create a {@link PropertySet}.</p> | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs. | |||||
* @throws IOException if an I/O exception occurs. | |||||
* | * | ||||
* @exception UnsupportedEncodingException if a character encoding is not | |||||
* @throws UnsupportedEncodingException if a character encoding is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
@Test | @Test | ||||
* property sets: the first one is a {@link SummaryInformation}, | * property sets: the first one is a {@link SummaryInformation}, | ||||
* the second one is a {@link DocumentSummaryInformation}.</p> | * the second one is a {@link DocumentSummaryInformation}.</p> | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception HPSFException if any HPSF exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws HPSFException if any HPSF exception occurs | |||||
*/ | */ | ||||
@Test | @Test | ||||
void testPropertySetMethods() throws IOException, HPSFException { | void testPropertySetMethods() throws IOException, HPSFException { | ||||
* property sets: the first one is a {@link SummaryInformation}, | * property sets: the first one is a {@link SummaryInformation}, | ||||
* the second one is a {@link DocumentSummaryInformation}.</p> | * the second one is a {@link DocumentSummaryInformation}.</p> | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception HPSFException if any HPSF exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws HPSFException if any HPSF exception occurs | |||||
*/ | */ | ||||
@Test | @Test | ||||
void testSectionMethods() throws IOException, HPSFException { | void testSectionMethods() throws IOException, HPSFException { |
/** | /** | ||||
* <p>Read a the test file from the "data" directory.</p> | * <p>Read a the test file from the "data" directory.</p> | ||||
* | * | ||||
* @exception FileNotFoundException if the file containing the test data | |||||
* @throws FileNotFoundException if the file containing the test data | |||||
* does not exist | * does not exist | ||||
* @exception IOException if an I/O exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
*/ | */ | ||||
@BeforeEach | @BeforeEach | ||||
void setUp() throws IOException { | void setUp() throws IOException { | ||||
* NoPropertySetStreamException} will be thrown when trying to | * NoPropertySetStreamException} will be thrown when trying to | ||||
* create a {@link PropertySet}.</p> | * create a {@link PropertySet}.</p> | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs. | |||||
* @throws IOException if an I/O exception occurs. | |||||
* | * | ||||
* @exception UnsupportedEncodingException if a character encoding is not | |||||
* @throws UnsupportedEncodingException if a character encoding is not | |||||
* supported. | * supported. | ||||
*/ | */ | ||||
@Test | @Test | ||||
* property sets: the first one is a {@link SummaryInformation}, | * property sets: the first one is a {@link SummaryInformation}, | ||||
* the second one is a {@link DocumentSummaryInformation}.</p> | * the second one is a {@link DocumentSummaryInformation}.</p> | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception HPSFException if an HPSF operation fails | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws HPSFException if an HPSF operation fails | |||||
*/ | */ | ||||
@Test | @Test | ||||
void testPropertySetMethods() throws IOException, HPSFException { | void testPropertySetMethods() throws IOException, HPSFException { |
* property set: the first one is a {@link SummaryInformation}, | * property set: the first one is a {@link SummaryInformation}, | ||||
* the second one is a {@link DocumentSummaryInformation}. | * the second one is a {@link DocumentSummaryInformation}. | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception HPSFException if an HPSF exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws HPSFException if an HPSF exception occurs | |||||
*/ | */ | ||||
@Test | @Test | ||||
void testPropertySetMethods() throws IOException, HPSFException { | void testPropertySetMethods() throws IOException, HPSFException { |
/** | /** | ||||
* Writes an empty property set to a POIFS and reads it back in. | * Writes an empty property set to a POIFS and reads it back in. | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
*/ | */ | ||||
@Test | @Test | ||||
void withoutAFormatID() throws Exception { | void withoutAFormatID() throws Exception { | ||||
/** | /** | ||||
* Writes an empty property set to a POIFS and reads it back in. | * Writes an empty property set to a POIFS and reads it back in. | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception UnsupportedVariantTypeException if HPSF does not yet support | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws UnsupportedVariantTypeException if HPSF does not yet support | |||||
* a variant type to be written | * a variant type to be written | ||||
*/ | */ | ||||
@Test | @Test | ||||
* <p>Writes a simple property set with a SummaryInformation section to a | * <p>Writes a simple property set with a SummaryInformation section to a | ||||
* POIFS and reads it back in.</p> | * POIFS and reads it back in.</p> | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception UnsupportedVariantTypeException if HPSF does not yet support | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws UnsupportedVariantTypeException if HPSF does not yet support | |||||
* a variant type to be written | * a variant type to be written | ||||
*/ | */ | ||||
@Test | @Test | ||||
* Writes a simple property set with two sections to a POIFS and reads it | * Writes a simple property set with two sections to a POIFS and reads it | ||||
* back in. | * back in. | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @exception WritingNotSupportedException if HPSF does not yet support | |||||
* @throws IOException if an I/O exception occurs | |||||
* @throws WritingNotSupportedException if HPSF does not yet support | |||||
* a variant type to be written | * a variant type to be written | ||||
*/ | */ | ||||
@Test | @Test |
* @return The POI files. The elements are ordered in the same way | * @return The POI files. The elements are ordered in the same way | ||||
* as the files in the POI filesystem. | * as the files in the POI filesystem. | ||||
* | * | ||||
* @exception FileNotFoundException if the file containing the POI | |||||
* @throws FileNotFoundException if the file containing the POI | |||||
* filesystem does not exist | * filesystem does not exist | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
*/ | */ | ||||
static List<POIFile> readPOIFiles(final File poiFs, final String... poiFiles) throws IOException { | static List<POIFile> readPOIFiles(final File poiFs, final String... poiFiles) throws IOException { | ||||
final List<POIFile> files = new ArrayList<>(); | final List<POIFile> files = new ArrayList<>(); | ||||
* @return The property sets. The elements are ordered in the same way | * @return The property sets. The elements are ordered in the same way | ||||
* as the files in the POI filesystem. | * as the files in the POI filesystem. | ||||
* | * | ||||
* @exception IOException if an I/O exception occurs | |||||
* @throws IOException if an I/O exception occurs | |||||
*/ | */ | ||||
static List<POIFile> readPropertySets(final File poiFs) throws IOException { | static List<POIFile> readPropertySets(final File poiFs) throws IOException { | ||||
final List<POIFile> files = new ArrayList<>(7); | final List<POIFile> files = new ArrayList<>(7); |
* @param is the InputStream from which the records will be obtained | * @param is the InputStream from which the records will be obtained | ||||
* @param ps the PrintWriter to output the record data | * @param ps the PrintWriter to output the record data | ||||
* | * | ||||
* @exception RecordFormatException on error processing the InputStream | |||||
* @throws RecordFormatException on error processing the InputStream | |||||
*/ | */ | ||||
private void createRecords(InputStream is, PrintWriter ps) throws RecordFormatException { | private void createRecords(InputStream is, PrintWriter ps) throws RecordFormatException { | ||||
RecordInputStream recStream = new RecordInputStream(is); | RecordInputStream recStream = new RecordInputStream(is); |
javaDocMethodReturn[00] = " *" | javaDocMethodReturn[00] = " *" | ||||
javaDocMethodReturn[01] = " * @return" | javaDocMethodReturn[01] = " * @return" | ||||
javaDocMethodExceptionSeparator[00] = " *" | javaDocMethodExceptionSeparator[00] = " *" | ||||
javaDocMethodException[00] = " * @exception $exceptionName$" | |||||
javaDocMethodException[00] = " * @throws $exceptionName$" | |||||
javaDocMethodBottom[00] = " *" | javaDocMethodBottom[00] = " *" | ||||
javaDocMethodBottom[01] = " */" | javaDocMethodBottom[01] = " */" | ||||
javaDocConstructorTop[00] = "/**" | javaDocConstructorTop[00] = "/**" | ||||
javaDocConstructorParamSeparator[00] = " *" | javaDocConstructorParamSeparator[00] = " *" | ||||
javaDocConstructorParam[00] = " * @param $paramName$" | javaDocConstructorParam[00] = " * @param $paramName$" | ||||
javaDocConstructorExceptionSeparator[00] = " *" | javaDocConstructorExceptionSeparator[00] = " *" | ||||
javaDocConstructorException[00] = " * @exception $exceptionName$" | |||||
javaDocConstructorException[00] = " * @throws $exceptionName$" | |||||
javaDocConstructorBottom[00] = " *" | javaDocConstructorBottom[00] = " *" | ||||
javaDocConstructorBottom[01] = " */" | javaDocConstructorBottom[01] = " */" | ||||
javaDocClass[00] = "/**" | javaDocClass[00] = "/**" |