/** Test method. */ @Test public void textEntry() { query(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1)); query(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1, "US-ASCII")); error(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1, "xyz"), Err.ZIP_FAIL); // newlines are removed from the result.. contains(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1), "aaboutab"); }
/** Test method. */ @Test public void binaryEntry() { query(_ZIP_BINARY_ENTRY.args(ZIP, ENTRY1)); contains("xs:hexBinary(" + _ZIP_BINARY_ENTRY.args(ZIP, ENTRY1) + ")", "610A61626F"); error(_ZIP_BINARY_ENTRY.args("abc", "xyz"), Err.ZIP_NOTFOUND); error(_ZIP_BINARY_ENTRY.args(ZIP, ""), Err.ZIP_NOTFOUND); }
/** * Sets the output text. * * @param text output text * @param size text size */ public final void setText(final byte[] text, final int size) { byte[] txt = text; if (Token.contains(text, '\r')) { // remove carriage returns int ns = 0; for (int r = 0; r < size; ++r) { final byte b = text[r]; if (b != '\r') text[ns++] = b; } // new text is different... txt = Arrays.copyOf(text, ns); } else if (text.length != size) { txt = Arrays.copyOf(text, size); } if (editor.text(txt)) { if (hist != null) hist.store(txt, editor.pos(), 0); } if (isShowing()) resizeCode.invokeLater(); }