/** * Copies the bytes into a new array and returns it. * * @param pos the position to read from * @param length the number of bytes to read * @return The bytes read */ public byte[] read(int pos, int length) { byte[] ret = new byte[length]; try { System.arraycopy(data, pos, ret, 0, length); } catch (ArrayIndexOutOfBoundsException e) { logger.error("Array index out of bounds at position " + pos + " record length " + length); throw e; } return ret; }
/** * Factory method to return the logger */ public static final Logger getLogger(Class cl) { if (logger == null) { initializeLogger(); } return logger.getLoggerImpl(cl); }
/** * Constructor * * @param output * @param input */ public ReadWrite(String input, String output) { inputWorkbook = new File(input); outputWorkbook = new File(output); logger.setSuppressWarnings(Boolean.getBoolean("jxl.nowarnings")); logger.info("Input file: " + input); logger.info("Output file: " + output); }
/** * Constructs this object from the raw data in biff 7 format. * Does nothing here * * @param t the raw data * @param settings the workbook settings * @param dummy dummy override to identify biff7 funcionality */ ExternalSheetRecord(Record t, WorkbookSettings settings, Biff7 dummy) { super(t); logger.warn("External sheet record for Biff 7 not supported"); }
/** * Reads in the inputFile and creates a writable copy of it called outputFile * * @exception IOException * @exception BiffException */ public void readWrite() throws IOException, BiffException, WriteException { logger.info("Reading..."); Workbook w1 = Workbook.getWorkbook(inputWorkbook); logger.info("Copying..."); WritableWorkbook w2 = Workbook.createWorkbook(outputWorkbook, w1); if (inputWorkbook.getName().equals("jxlrwtest.xls")) { modify(w2); } w2.write(); w2.close(); logger.info("Done"); }
/** * Accessor to set the suppress warnings flag. Due to the change * in logging in version 2.4, this will now set the warning * behaviour across the JVM (depending on the type of logger used) * * @param w the flag */ public void setSuppressWarnings(boolean w) { logger.setSuppressWarnings(w); }
private static Logger logger = Logger.getLogger(WritableWorkbookImpl.class);
/** * Sets the cell features during the reading process * * @param cf the cell features */ public void setCellFeatures(CellFeatures cf) { if (features != null) { logger.warn("current cell features not null - overwriting"); } features = cf; } }
/** * Reads in the inputFile and creates a writable copy of it called outputFile * * @exception IOException * @exception BiffException */ public void readWrite() throws IOException, BiffException, WriteException { logger.info("Reading..."); Workbook w1 = Workbook.getWorkbook(inputWorkbook); logger.info("Copying..."); WritableWorkbook w2 = Workbook.createWorkbook(outputWorkbook, w1); if (inputWorkbook.getName().equals("jxlrwtest.xls")) { modify(w2); } w2.write(); w2.close(); logger.info("Done"); }
/** * Accessor to set the suppress warnings flag. Due to the change * in logging in version 2.4, this will now set the warning * behaviour across the JVM (depending on the type of logger used) * * @param w the flag */ public void setSuppressWarnings(boolean w) { logger.setSuppressWarnings(w); }
private static Logger logger = Logger.getLogger(WritableWorkbookImpl.class);
/** * Sets the cell features during the reading process * * @param cf the cell features */ public void setCellFeatures(CellFeatures cf) { if (features != null) { logger.warn("current cell features not null - overwriting"); } features = cf; } }
/** * Factory method to return the logger */ public static final Logger getLogger(Class cl) { if (logger == null) { initializeLogger(); } return logger.getLoggerImpl(cl); }
/** * Constructor * * @param output * @param input */ public ReadWrite(String input, String output) { inputWorkbook = new File(input); outputWorkbook = new File(output); logger.setSuppressWarnings(Boolean.getBoolean("jxl.nowarnings")); logger.info("Input file: " + input); logger.info("Output file: " + output); }