target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testStopWithNoFileUsingExecutor() throws Exception { final File file = new File(getTestDirectory(),"nosuchfile"); assertFalse("nosuchfile should not exist", file.exists()); final TestTailerListener listener = new TestTailerListener(); final int delay = 100; final int idle = 50; tailer = new Tailer(fil...
private void stop(final Exception e) { listener.handle(e); stop(); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener); Tailer(final File file, final TailerListener listener, final long delayMillis); Tailer(final File file, final TailerListener listener, final long delayMillis, final...
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener); Tailer(final File file, final TailerListener listener, final long delayMillis); Tailer(final File file, final TailerListener listener, final long delayMillis, final...
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener); Tailer(final File file, final TailerListener listener, final long delayMillis); Tailer(final File file, final TailerListener listener, final long delayMillis, final...
@Test public void testIO335() throws Exception { final long delayMillis = 50; final File file = new File(getTestDirectory(), "tailer-testio334.txt"); createFile(file, 0); final TestTailerListener listener = new TestTailerListener(); tailer = new Tailer(file, listener, delayMillis, false); final Thread thread = new Thre...
private void stop(final Exception e) { listener.handle(e); stop(); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener); Tailer(final File file, final TailerListener listener, final long delayMillis); Tailer(final File file, final TailerListener listener, final long delayMillis, final...
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener); Tailer(final File file, final TailerListener listener, final long delayMillis); Tailer(final File file, final TailerListener listener, final long delayMillis, final...
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener); Tailer(final File file, final TailerListener listener, final long delayMillis); Tailer(final File file, final TailerListener listener, final long delayMillis, final...
@Test public void testRawContent() throws Exception { final String encoding = "UTF-8"; final String xml = getXML("no-bom", XML3, encoding, encoding); final ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes(encoding)); final XmlStreamReader xmlReader = new XmlStreamReader(is); assertEquals("Check encoding"...
public String getEncoding() { return encoding; }
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } }
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } XmlStreamReader(final File file); XmlStreamReader(final InputStream is); XmlStreamReader(final InputStream is, final boolean lenient); XmlStreamReader(final InputStream is, final boolean lenient, final String defaultEncoding); XmlStre...
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } XmlStreamReader(final File file); XmlStreamReader(final InputStream is); XmlStreamReader(final InputStream is, final boolean lenient); XmlStreamReader(final InputStream is, final boolean lenient, final String defaultEncoding); XmlStre...
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } XmlStreamReader(final File file); XmlStreamReader(final InputStream is); XmlStreamReader(final InputStream is, final boolean lenient); XmlStreamReader(final InputStream is, final boolean lenient, final String defaultEncoding); XmlStre...
@Test public void testHttpContent() throws Exception { final String encoding = "UTF-8"; final String xml = getXML("no-bom", XML3, encoding, encoding); final ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes(encoding)); final XmlStreamReader xmlReader = new XmlStreamReader(is, encoding); assertEquals("Chec...
public String getEncoding() { return encoding; }
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } }
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } XmlStreamReader(final File file); XmlStreamReader(final InputStream is); XmlStreamReader(final InputStream is, final boolean lenient); XmlStreamReader(final InputStream is, final boolean lenient, final String defaultEncoding); XmlStre...
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } XmlStreamReader(final File file); XmlStreamReader(final InputStream is); XmlStreamReader(final InputStream is, final boolean lenient); XmlStreamReader(final InputStream is, final boolean lenient, final String defaultEncoding); XmlStre...
XmlStreamReader extends Reader { public String getEncoding() { return encoding; } XmlStreamReader(final File file); XmlStreamReader(final InputStream is); XmlStreamReader(final InputStream is, final boolean lenient); XmlStreamReader(final InputStream is, final boolean lenient, final String defaultEncoding); XmlStre...
@Test public void closeTest() throws IOException { final AtomicBoolean closed = new AtomicBoolean( false ); final Reader sr = new BufferedReader( new StringReader( "01234567890" ) ) { @Override public void close() throws IOException { closed.set( true ); super.close(); } }; BoundedReader mr = new BoundedReader( sr, 3 )...
@Override public void close() throws IOException { target.close(); }
BoundedReader extends Reader { @Override public void close() throws IOException { target.close(); } }
BoundedReader extends Reader { @Override public void close() throws IOException { target.close(); } BoundedReader( Reader target, int maxCharsFromTargetReader ); }
BoundedReader extends Reader { @Override public void close() throws IOException { target.close(); } BoundedReader( Reader target, int maxCharsFromTargetReader ); @Override void close(); @Override void reset(); @Override void mark( int readAheadLimit ); @Override int read(); @Override int read( char[] cbuf, int off, int...
BoundedReader extends Reader { @Override public void close() throws IOException { target.close(); } BoundedReader( Reader target, int maxCharsFromTargetReader ); @Override void close(); @Override void reset(); @Override void mark( int readAheadLimit ); @Override int read(); @Override int read( char[] cbuf, int off, int...
@Test public void testReadSingle() throws Exception { BoundedInputStream bounded; final byte[] helloWorld = "Hello World".getBytes(); final byte[] hello = "Hello".getBytes(); bounded = new BoundedInputStream(new ByteArrayInputStream(helloWorld), helloWorld.length); for (int i = 0; i < helloWorld.length; i++) { assertEq...
@Override public int read() throws IOException { if (max >= 0 && pos >= max) { return EOF; } final int result = in.read(); pos++; return result; }
BoundedInputStream extends InputStream { @Override public int read() throws IOException { if (max >= 0 && pos >= max) { return EOF; } final int result = in.read(); pos++; return result; } }
BoundedInputStream extends InputStream { @Override public int read() throws IOException { if (max >= 0 && pos >= max) { return EOF; } final int result = in.read(); pos++; return result; } BoundedInputStream(final InputStream in, final long size); BoundedInputStream(final InputStream in); }
BoundedInputStream extends InputStream { @Override public int read() throws IOException { if (max >= 0 && pos >= max) { return EOF; } final int result = in.read(); pos++; return result; } BoundedInputStream(final InputStream in, final long size); BoundedInputStream(final InputStream in); @Override int read(); @Overrid...
BoundedInputStream extends InputStream { @Override public int read() throws IOException { if (max >= 0 && pos >= max) { return EOF; } final int result = in.read(); pos++; return result; } BoundedInputStream(final InputStream in, final long size); BoundedInputStream(final InputStream in); @Override int read(); @Overrid...
@Test public void eachAttr() { Document doc = Jsoup.parse( "<div><a href='/foo'>1</a><a href='http: "http: List<String> hrefAttrs = doc.select("a").eachAttr("href"); assertEquals(3, hrefAttrs.size()); assertEquals("/foo", hrefAttrs.get(0)); assertEquals("http: assertEquals("", hrefAttrs.get(2)); assertEquals(4, doc.sel...
public List<String> eachAttr(String attributeKey) { List<String> attrs = new ArrayList<>(size()); for (Element element : this) { if (element.hasAttr(attributeKey)) attrs.add(element.attr(attributeKey)); } return attrs; }
Elements extends ArrayList<Element> { public List<String> eachAttr(String attributeKey) { List<String> attrs = new ArrayList<>(size()); for (Element element : this) { if (element.hasAttr(attributeKey)) attrs.add(element.attr(attributeKey)); } return attrs; } }
Elements extends ArrayList<Element> { public List<String> eachAttr(String attributeKey) { List<String> attrs = new ArrayList<>(size()); for (Element element : this) { if (element.hasAttr(attributeKey)) attrs.add(element.attr(attributeKey)); } return attrs; } Elements(); Elements(int initialCapacity); Elements(Collect...
Elements extends ArrayList<Element> { public List<String> eachAttr(String attributeKey) { List<String> attrs = new ArrayList<>(size()); for (Element element : this) { if (element.hasAttr(attributeKey)) attrs.add(element.attr(attributeKey)); } return attrs; } Elements(); Elements(int initialCapacity); Elements(Collect...
Elements extends ArrayList<Element> { public List<String> eachAttr(String attributeKey) { List<String> attrs = new ArrayList<>(size()); for (Element element : this) { if (element.hasAttr(attributeKey)) attrs.add(element.attr(attributeKey)); } return attrs; } Elements(); Elements(int initialCapacity); Elements(Collect...
@Test public void testRead() { try { stream.read(); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } try { stream.read(new byte[1]); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } try { stream.read(new byte[1], 0...
@Override public int read() throws IOException { throw exception; }
BrokenInputStream extends InputStream { @Override public int read() throws IOException { throw exception; } }
BrokenInputStream extends InputStream { @Override public int read() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); }
BrokenInputStream extends InputStream { @Override public int read() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Override void close(...
BrokenInputStream extends InputStream { @Override public int read() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Override void close(...
@Test public void testAvailable() { try { stream.available(); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public int available() throws IOException { throw exception; }
BrokenInputStream extends InputStream { @Override public int available() throws IOException { throw exception; } }
BrokenInputStream extends InputStream { @Override public int available() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); }
BrokenInputStream extends InputStream { @Override public int available() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Override void c...
BrokenInputStream extends InputStream { @Override public int available() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Override void c...
@Test public void testSkip() { try { stream.skip(1); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public long skip(final long n) throws IOException { throw exception; }
BrokenInputStream extends InputStream { @Override public long skip(final long n) throws IOException { throw exception; } }
BrokenInputStream extends InputStream { @Override public long skip(final long n) throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); }
BrokenInputStream extends InputStream { @Override public long skip(final long n) throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Overrid...
BrokenInputStream extends InputStream { @Override public long skip(final long n) throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Overrid...
@Test public void testReset() { try { stream.reset(); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public synchronized void reset() throws IOException { throw exception; }
BrokenInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw exception; } }
BrokenInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); }
BrokenInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Overr...
BrokenInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Overr...
@Test public void testClose() { try { stream.close(); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public void close() throws IOException { throw exception; }
BrokenInputStream extends InputStream { @Override public void close() throws IOException { throw exception; } }
BrokenInputStream extends InputStream { @Override public void close() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); }
BrokenInputStream extends InputStream { @Override public void close() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Override void clos...
BrokenInputStream extends InputStream { @Override public void close() throws IOException { throw exception; } BrokenInputStream(final IOException exception); BrokenInputStream(); @Override int read(); @Override int available(); @Override long skip(final long n); @Override synchronized void reset(); @Override void clos...
@Test public void testCounting() throws Exception { final String text = "A piece of text"; final byte[] bytes = text.getBytes(); final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); final CountingInputStream cis = new CountingInputStream(bais); final byte[] result = new byte[21]; final byte[] ba = new byt...
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testZeroLength1() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); final CountingInputStream cis = new CountingInputStream(bais); final int found = cis.read(); assertEquals(-1, found); assertEquals(0, cis.getCount()); cis.close(); }
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testZeroLength2() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); final CountingInputStream cis = new CountingInputStream(bais); final byte[] result = new byte[10]; final int found = cis.read(result); assertEquals(-1, found); assertEquals(0, cis.getCount());...
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testZeroLength3() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); final CountingInputStream cis = new CountingInputStream(bais); final byte[] result = new byte[10]; final int found = cis.read(result, 0, 5); assertEquals(-1, found); assertEquals(0, cis.getCou...
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testEOF1() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]); final CountingInputStream cis = new CountingInputStream(bais); int found = cis.read(); assertEquals(0, found); assertEquals(1, cis.getCount()); found = cis.read(); assertEquals(0, found); assertEqual...
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testByTag() { Elements els = Jsoup.parse("<div id=1><div id=2><p>Hello</p></div></div><DIV id=3>").select("DIV"); assertEquals(3, els.size()); assertEquals("1", els.get(0).id()); assertEquals("2", els.get(1).id()); assertEquals("3", els.get(2).id()); Elements none = Jsoup.parse("<div id=1><div id=2><p...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testEOF2() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]); final CountingInputStream cis = new CountingInputStream(bais); final byte[] result = new byte[10]; final int found = cis.read(result); assertEquals(2, found); assertEquals(2, cis.getCount()); cis.clo...
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testEOF3() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]); final CountingInputStream cis = new CountingInputStream(bais); final byte[] result = new byte[10]; final int found = cis.read(result, 0, 5); assertEquals(2, found); assertEquals(2, cis.getCount()); c...
public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); }
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
CountingInputStream extends ProxyInputStream { public int getCount() { final long result = getByteCount(); if (result > Integer.MAX_VALUE) { throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int"); } return (int) result; } CountingInputStream(final InputStream in); @Overrid...
@Test public void testClose() throws IOException { stream.close(); assertTrue("closed", closed); assertEquals("read()", -1, stream.read()); }
@Override public void close() throws IOException { in.close(); in = new ClosedInputStream(); }
AutoCloseInputStream extends ProxyInputStream { @Override public void close() throws IOException { in.close(); in = new ClosedInputStream(); } }
AutoCloseInputStream extends ProxyInputStream { @Override public void close() throws IOException { in.close(); in = new ClosedInputStream(); } AutoCloseInputStream(final InputStream in); }
AutoCloseInputStream extends ProxyInputStream { @Override public void close() throws IOException { in.close(); in = new ClosedInputStream(); } AutoCloseInputStream(final InputStream in); @Override void close(); }
AutoCloseInputStream extends ProxyInputStream { @Override public void close() throws IOException { in.close(); in = new ClosedInputStream(); } AutoCloseInputStream(final InputStream in); @Override void close(); }
@Test public void testDump() throws IOException { final byte[] testArray = new byte[256]; for (int j = 0; j < 256; j++) { testArray[j] = (byte) j; } ByteArrayOutputStream stream = new ByteArrayOutputStream(); HexDump.dump(testArray, 0, stream, 0); byte[] outputArray = new byte[16 * (73 + HexDump.EOL.length())]; for (in...
public static void dump(final byte[] data, final long offset, final OutputStream stream, final int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException { if (index < 0 || index >= data.length) { throw new ArrayIndexOutOfBoundsException( "illegal index: " + index + " into array of length "...
HexDump { public static void dump(final byte[] data, final long offset, final OutputStream stream, final int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException { if (index < 0 || index >= data.length) { throw new ArrayIndexOutOfBoundsException( "illegal index: " + index + " into array o...
HexDump { public static void dump(final byte[] data, final long offset, final OutputStream stream, final int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException { if (index < 0 || index >= data.length) { throw new ArrayIndexOutOfBoundsException( "illegal index: " + index + " into array o...
HexDump { public static void dump(final byte[] data, final long offset, final OutputStream stream, final int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException { if (index < 0 || index >= data.length) { throw new ArrayIndexOutOfBoundsException( "illegal index: " + index + " into array o...
HexDump { public static void dump(final byte[] data, final long offset, final OutputStream stream, final int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException { if (index < 0 || index >= data.length) { throw new ArrayIndexOutOfBoundsException( "illegal index: " + index + " into array o...
@Test public void testThresholdReached() { final File testFile = new File("testThresholdReached.dat"); testFile.delete(); final DeferredFileOutputStream dfos = new DeferredFileOutputStream(testBytes.length / 2, testFile); final int chunkSize = testBytes.length / 3; try { dfos.write(testBytes, 0, chunkSize); dfos.write(...
@Override protected void thresholdReached() throws IOException { if (prefix != null) { outputFile = File.createTempFile(prefix, suffix, directory); } final FileOutputStream fos = new FileOutputStream(outputFile); try { memoryOutputStream.writeTo(fos); } catch (IOException e){ fos.close(); throw e; } currentOutputStream...
DeferredFileOutputStream extends ThresholdingOutputStream { @Override protected void thresholdReached() throws IOException { if (prefix != null) { outputFile = File.createTempFile(prefix, suffix, directory); } final FileOutputStream fos = new FileOutputStream(outputFile); try { memoryOutputStream.writeTo(fos); } catch ...
DeferredFileOutputStream extends ThresholdingOutputStream { @Override protected void thresholdReached() throws IOException { if (prefix != null) { outputFile = File.createTempFile(prefix, suffix, directory); } final FileOutputStream fos = new FileOutputStream(outputFile); try { memoryOutputStream.writeTo(fos); } catch ...
DeferredFileOutputStream extends ThresholdingOutputStream { @Override protected void thresholdReached() throws IOException { if (prefix != null) { outputFile = File.createTempFile(prefix, suffix, directory); } final FileOutputStream fos = new FileOutputStream(outputFile); try { memoryOutputStream.writeTo(fos); } catch ...
DeferredFileOutputStream extends ThresholdingOutputStream { @Override protected void thresholdReached() throws IOException { if (prefix != null) { outputFile = File.createTempFile(prefix, suffix, directory); } final FileOutputStream fos = new FileOutputStream(outputFile); try { memoryOutputStream.writeTo(fos); } catch ...
@Test public void testTempFileError() throws Exception { final String prefix = null; final String suffix = ".out"; final File tempDir = new File("."); try { (new DeferredFileOutputStream(testBytes.length - 5, prefix, suffix, tempDir)).close(); fail("Expected IllegalArgumentException "); } catch (final IllegalArgumentEx...
@Override public void close() throws IOException { super.close(); closed = true; }
DeferredFileOutputStream extends ThresholdingOutputStream { @Override public void close() throws IOException { super.close(); closed = true; } }
DeferredFileOutputStream extends ThresholdingOutputStream { @Override public void close() throws IOException { super.close(); closed = true; } DeferredFileOutputStream(final int threshold, final File outputFile); DeferredFileOutputStream(final int threshold, final String prefix, final String suffix, final File directo...
DeferredFileOutputStream extends ThresholdingOutputStream { @Override public void close() throws IOException { super.close(); closed = true; } DeferredFileOutputStream(final int threshold, final File outputFile); DeferredFileOutputStream(final int threshold, final String prefix, final String suffix, final File directo...
DeferredFileOutputStream extends ThresholdingOutputStream { @Override public void close() throws IOException { super.close(); closed = true; } DeferredFileOutputStream(final int threshold, final File outputFile); DeferredFileOutputStream(final int threshold, final String prefix, final String suffix, final File directo...
@Test public void testWrite() { try { stream.write(1); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } try { stream.write(new byte[1]); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } try { stream.write(new byte[...
@Override public void write(final int b) throws IOException { throw exception; }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
@Test public void testFlush() { try { stream.flush(); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public void flush() throws IOException { throw exception; }
BrokenOutputStream extends OutputStream { @Override public void flush() throws IOException { throw exception; } }
BrokenOutputStream extends OutputStream { @Override public void flush() throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); }
BrokenOutputStream extends OutputStream { @Override public void flush() throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
BrokenOutputStream extends OutputStream { @Override public void flush() throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
@Test public void testClose() { try { stream.close(); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public void close() throws IOException { throw exception; }
BrokenOutputStream extends OutputStream { @Override public void close() throws IOException { throw exception; } }
BrokenOutputStream extends OutputStream { @Override public void close() throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); }
BrokenOutputStream extends OutputStream { @Override public void close() throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
BrokenOutputStream extends OutputStream { @Override public void close() throws IOException { throw exception; } BrokenOutputStream(final IOException exception); BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
@Test(expected = UnsupportedEncodingException.class) public void exceptions_in_close() throws IOException { OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void close() throws IOException { throw new UnsupportedEncodingException("Bah"); } }; final ProxyWriter proxy = new ...
@Override public void close() throws IOException { try { out.close(); } catch (final IOException e) { handleIOException(e); } }
ProxyWriter extends FilterWriter { @Override public void close() throws IOException { try { out.close(); } catch (final IOException e) { handleIOException(e); } } }
ProxyWriter extends FilterWriter { @Override public void close() throws IOException { try { out.close(); } catch (final IOException e) { handleIOException(e); } } ProxyWriter(final Writer proxy); }
ProxyWriter extends FilterWriter { @Override public void close() throws IOException { try { out.close(); } catch (final IOException e) { handleIOException(e); } } ProxyWriter(final Writer proxy); @Override Writer append(final char c); @Override Writer append(final CharSequence csq, final int start, final int end); @Ove...
ProxyWriter extends FilterWriter { @Override public void close() throws IOException { try { out.close(); } catch (final IOException e) { handleIOException(e); } } ProxyWriter(final Writer proxy); @Override Writer append(final char c); @Override Writer append(final CharSequence csq, final int start, final int end); @Ove...
@Test public void testClose() { final Writer writer = new StringBuilderWriter(); try { writer.append("Foo"); writer.close(); writer.append("Bar"); } catch (final Throwable t) { fail("Threw: " + t); } assertEquals("FooBar", writer.toString()); }
@Override public void close() { }
StringBuilderWriter extends Writer implements Serializable { @Override public void close() { } }
StringBuilderWriter extends Writer implements Serializable { @Override public void close() { } StringBuilderWriter(); StringBuilderWriter(final int capacity); StringBuilderWriter(final StringBuilder builder); }
StringBuilderWriter extends Writer implements Serializable { @Override public void close() { } StringBuilderWriter(); StringBuilderWriter(final int capacity); StringBuilderWriter(final StringBuilder builder); @Override Writer append(final char value); @Override Writer append(final CharSequence value); @Override Write...
StringBuilderWriter extends Writer implements Serializable { @Override public void close() { } StringBuilderWriter(); StringBuilderWriter(final int capacity); StringBuilderWriter(final StringBuilder builder); @Override Writer append(final char value); @Override Writer append(final CharSequence value); @Override Write...
@Test public void write_four_chunks() throws Exception { final AtomicInteger numWrites = new AtomicInteger(); ByteArrayOutputStream baos = getByteArrayOutputStream(numWrites); ChunkedOutputStream chunked = new ChunkedOutputStream(baos, 10); chunked.write("0123456789012345678901234567891".getBytes()); assertEquals(4, nu...
@Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } }
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } }
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } C...
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } C...
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } C...
@Test public void defaultConstructor() throws IOException { final AtomicInteger numWrites = new AtomicInteger(); ByteArrayOutputStream baos = getByteArrayOutputStream(numWrites); ChunkedOutputStream chunked = new ChunkedOutputStream(baos); chunked.write(new byte[1024 * 4 + 1]); assertEquals(2, numWrites.get()); chunked...
@Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } }
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } }
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } C...
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } C...
ChunkedOutputStream extends FilterOutputStream { @Override public void write(byte[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } C...
@Test public void testClose() throws IOException { shielded.close(); assertFalse("closed", closed); try { shielded.write('x'); fail("write(b)"); } catch (final IOException ignore) { } original.write('y'); assertEquals(1, original.size()); assertEquals('y', original.toByteArray()[0]); }
@Override public void close() { out = new ClosedOutputStream(); }
CloseShieldOutputStream extends ProxyOutputStream { @Override public void close() { out = new ClosedOutputStream(); } }
CloseShieldOutputStream extends ProxyOutputStream { @Override public void close() { out = new ClosedOutputStream(); } CloseShieldOutputStream(final OutputStream out); }
CloseShieldOutputStream extends ProxyOutputStream { @Override public void close() { out = new ClosedOutputStream(); } CloseShieldOutputStream(final OutputStream out); @Override void close(); }
CloseShieldOutputStream extends ProxyOutputStream { @Override public void close() { out = new ClosedOutputStream(); } CloseShieldOutputStream(final OutputStream out); @Override void close(); }
@Test public void write_four_chunks() throws Exception { final AtomicInteger numWrites = new AtomicInteger(); OutputStreamWriter osw = getOutputStreamWriter(numWrites); ChunkedWriter chunked = new ChunkedWriter(osw, 10); chunked.write("0123456789012345678901234567891".toCharArray()); chunked.flush(); assertEquals(4, nu...
@Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter...
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter...
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter...
@Test public void write_two_chunks_default_constructor() throws Exception { final AtomicInteger numWrites = new AtomicInteger(); OutputStreamWriter osw = getOutputStreamWriter(numWrites); ChunkedWriter chunked = new ChunkedWriter(osw); chunked.write(new char[1024 * 4 + 1]); chunked.flush(); assertEquals(2, numWrites.ge...
@Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter...
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter...
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter...
@Test public void testFlush() throws IOException { final StringWriter writer = new StringWriter(); final WriterOutputStream out = new WriterOutputStream(writer, "us-ascii", 1024, false); out.write("abc".getBytes("us-ascii")); assertEquals(0, writer.getBuffer().length()); out.flush(); assertEquals("abc", writer.toString...
@Override public void flush() throws IOException { flushOutput(); writer.flush(); }
WriterOutputStream extends OutputStream { @Override public void flush() throws IOException { flushOutput(); writer.flush(); } }
WriterOutputStream extends OutputStream { @Override public void flush() throws IOException { flushOutput(); writer.flush(); } WriterOutputStream(final Writer writer, final CharsetDecoder decoder); WriterOutputStream(final Writer writer, final CharsetDecoder decoder, final int bufferSize, ...
WriterOutputStream extends OutputStream { @Override public void flush() throws IOException { flushOutput(); writer.flush(); } WriterOutputStream(final Writer writer, final CharsetDecoder decoder); WriterOutputStream(final Writer writer, final CharsetDecoder decoder, final int bufferSize, ...
WriterOutputStream extends OutputStream { @Override public void flush() throws IOException { flushOutput(); writer.flush(); } WriterOutputStream(final Writer writer, final CharsetDecoder decoder); WriterOutputStream(final Writer writer, final CharsetDecoder decoder, final int bufferSize, ...
@Test public void testRead() throws Exception { ClosedOutputStream cos = null; try { cos = new ClosedOutputStream(); cos.write('x'); fail("write(b)"); } catch (final IOException e) { } finally { cos.close(); } }
@Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); }
ClosedOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); } }
ClosedOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); } }
ClosedOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); } @Override void write(final int b); }
ClosedOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); } @Override void write(final int b); static final ClosedOutputStream CLOSED_OUTPUT_STREAM; }
@Test public void testWrite() throws Exception { proxied.write('y'); assertEquals(1, original.size()); assertEquals('y', original.toByteArray()[0]); }
@Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } }
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } }
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); }
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); @Override void write(final int idx); @Override void w...
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); @Override void write(final int idx); @Override void w...
@Test public void testWriteNullBaSucceeds() throws Exception { final byte[] ba = null; original.write(ba); proxied.write(ba); }
@Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } }
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } }
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); }
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); @Override void write(final int idx); @Override void w...
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); @Override void write(final int idx); @Override void w...
@Test public void testByClass() { Elements els = Jsoup.parse("<p id=0 class='ONE two'><p id=1 class='one'><p id=2 class='two'>").select("P.One"); assertEquals(2, els.size()); assertEquals("0", els.get(0).id()); assertEquals("1", els.get(1).id()); Elements none = Jsoup.parse("<div class='one'></div>").select(".foo"); as...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testCloseBranchIOException() { final ByteArrayOutputStream badOs = new ExceptionOnCloseByteArrayOutputStream(); final RecordCloseByteArrayOutputStream goodOs = new RecordCloseByteArrayOutputStream(); final TeeOutputStream tos = new TeeOutputStream(goodOs, badOs); try { tos.close(); Assert.fail("Expect...
@Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); @Override synchronized void write(final byte[] b); @Override synchronized void write(final byte[] b...
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); @Override synchronized void write(final byte[] b); @Override synchronized void write(final byte[] b...
@Test public void testCloseMainIOException() { final ByteArrayOutputStream badOs = new ExceptionOnCloseByteArrayOutputStream(); final RecordCloseByteArrayOutputStream goodOs = new RecordCloseByteArrayOutputStream(); final TeeOutputStream tos = new TeeOutputStream(badOs, goodOs); try { tos.close(); Assert.fail("Expected...
@Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); @Override synchronized void write(final byte[] b); @Override synchronized void write(final byte[] b...
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); @Override synchronized void write(final byte[] b); @Override synchronized void write(final byte[] b...
@Test public void testNull() throws IOException { final NullOutputStream nos = new NullOutputStream(); nos.write("string".getBytes()); nos.write("some string".getBytes(), 3, 5); nos.write(1); nos.write(0x0f); nos.flush(); nos.close(); nos.write("allowed".getBytes()); nos.write(255); }
@Override public void write(final byte[] b, final int off, final int len) { }
NullOutputStream extends OutputStream { @Override public void write(final byte[] b, final int off, final int len) { } }
NullOutputStream extends OutputStream { @Override public void write(final byte[] b, final int off, final int len) { } }
NullOutputStream extends OutputStream { @Override public void write(final byte[] b, final int off, final int len) { } @Override void write(final byte[] b, final int off, final int len); @Override void write(final int b); @Override void write(final byte[] b); }
NullOutputStream extends OutputStream { @Override public void write(final byte[] b, final int off, final int len) { } @Override void write(final byte[] b, final int off, final int len); @Override void write(final int b); @Override void write(final byte[] b); static final NullOutputStream NULL_OUTPUT_STREAM; }
@Test public void testSetByteCount() throws Exception { final AtomicBoolean reached = new AtomicBoolean(false); ThresholdingOutputStream tos = new ThresholdingOutputStream(3) { { setByteCount(2); } @Override protected OutputStream getStream() throws IOException { return new ByteArrayOutputStream(4); } @Override protect...
protected void setByteCount(final long count) { this.written = count; }
ThresholdingOutputStream extends OutputStream { protected void setByteCount(final long count) { this.written = count; } }
ThresholdingOutputStream extends OutputStream { protected void setByteCount(final long count) { this.written = count; } ThresholdingOutputStream(final int threshold); }
ThresholdingOutputStream extends OutputStream { protected void setByteCount(final long count) { this.written = count; } ThresholdingOutputStream(final int threshold); @Override void write(final int b); @Override void write(final byte b[]); @Override void write(final byte b[], final int off, final int len); @Override vo...
ThresholdingOutputStream extends OutputStream { protected void setByteCount(final long count) { this.written = count; } ThresholdingOutputStream(final int threshold); @Override void write(final int b); @Override void write(final byte b[]); @Override void write(final byte b[], final int off, final int len); @Override vo...
@Test public void testTaggedIOException() { final Serializable tag = UUID.randomUUID(); final IOException exception = new IOException("Test exception"); final TaggedIOException tagged = new TaggedIOException(exception, tag); assertTrue(TaggedIOException.isTaggedWith(tagged, tag)); assertFalse(TaggedIOException.isTagged...
public TaggedIOException(final IOException original, final Serializable tag) { super(original.getMessage(), original); this.tag = tag; }
TaggedIOException extends IOExceptionWithCause { public TaggedIOException(final IOException original, final Serializable tag) { super(original.getMessage(), original); this.tag = tag; } }
TaggedIOException extends IOExceptionWithCause { public TaggedIOException(final IOException original, final Serializable tag) { super(original.getMessage(), original); this.tag = tag; } TaggedIOException(final IOException original, final Serializable tag); }
TaggedIOException extends IOExceptionWithCause { public TaggedIOException(final IOException original, final Serializable tag) { super(original.getMessage(), original); this.tag = tag; } TaggedIOException(final IOException original, final Serializable tag); static boolean isTaggedWith(final Throwable throwable, final Ob...
TaggedIOException extends IOExceptionWithCause { public TaggedIOException(final IOException original, final Serializable tag) { super(original.getMessage(), original); this.tag = tag; } TaggedIOException(final IOException original, final Serializable tag); static boolean isTaggedWith(final Throwable throwable, final Ob...
@Test public void copy_byteArrayToOutputStream() throws Exception { final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true); CopyUtils.copy(inData, out); assertEquals("Sizes differ", inData.length, baout.size()); assertTrue("Conte...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@Test public void copy_byteArrayToWriter() throws Exception { final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true); final Writer writer = new java.io.OutputStreamWriter(out, "US-ASCII"); CopyUtils.copy(inData, writer); writer.f...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@Test public void testCopy_byteArrayToWriterWithEncoding() throws Exception { final String inDataStr = "data"; final String charsetName = "UTF-8"; final StringWriter writer = new StringWriter(); CopyUtils.copy(inDataStr.getBytes(charsetName), writer, charsetName); assertEquals(inDataStr, writer.toString()); }
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@SuppressWarnings("resource") @Test public void testCopy_inputStreamToOutputStream() throws Exception { InputStream in = new ByteArrayInputStream(inData); in = new YellOnCloseInputStream(in); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new YellOnFlushAndCloseOutputStream(ba...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@SuppressWarnings("resource") @Test public void copy_inputStreamToWriter() throws Exception { InputStream in = new ByteArrayInputStream(inData); in = new YellOnCloseInputStream(in); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@Test public void testByClassCaseInsensitive() { String html = "<p Class=foo>One <p Class=Foo>Two <p class=FOO>Three <p class=farp>Four"; Elements elsFromClass = Jsoup.parse(html).select("P.Foo"); Elements elsFromAttr = Jsoup.parse(html).select("p[class=foo]"); assertEquals(elsFromAttr.size(), elsFromClass.size()); ass...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void copy_inputStreamToWriterWithEncoding() throws Exception { final String inDataStr = "data"; final String charsetName = "UTF-8"; final StringWriter writer = new StringWriter(); CopyUtils.copy(new ByteArrayInputStream(inDataStr.getBytes(charsetName)), writer, charsetName); assertEquals(inDataStr, writer....
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@SuppressWarnings("resource") @Test public void testCopy_readerToOutputStream() throws Exception { InputStream in = new ByteArrayInputStream(inData); in = new YellOnCloseInputStream(in); final Reader reader = new java.io.InputStreamReader(in, "US-ASCII"); final ByteArrayOutputStream baout = new ByteArrayOutputStream();...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@SuppressWarnings("resource") @Test public void copy_readerToWriter() throws Exception { InputStream in = new ByteArrayInputStream(inData); in = new YellOnCloseInputStream(in); final Reader reader = new java.io.InputStreamReader(in, "US-ASCII"); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final Out...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@Test public void copy_stringToOutputStream() throws Exception { final String str = new String(inData, "US-ASCII"); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true); CopyUtils.copy(str, out); assertEquals("Sizes differ", in...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@Test public void copy_stringToWriter() throws Exception { final String str = new String(inData, "US-ASCII"); final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true); final Writer writer = new java.io.OutputStreamWriter(out, "US-A...
public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); }
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
CopyUtils { public static void copy(final byte[] input, final OutputStream output) throws IOException { output.write(input); } CopyUtils(); static void copy(final byte[] input, final OutputStream output); @Deprecated static void copy(final byte[] input, final Writer output); static void copy( final byte[] i...
@Test @MultiLocaleTest public void testByAttribute() { String h = "<div Title=Foo /><div Title=Bar /><div Style=Qux /><div title=Balim /><div title=SLIM />" + "<div data-name='with spaces'/>"; Document doc = Jsoup.parse(h); Elements withTitle = doc.select("[title]"); assertEquals(4, withTitle.size()); Elements foo = do...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testWildcardNamespacedTag() { Document doc = Jsoup.parse("<div><abc:def id=1>Hello</abc:def></div> <abc:def class=bold id=2>There</abc:def>"); Elements byTag = doc.select("*|def"); assertEquals(2, byTag.size()); assertEquals("1", byTag.first().id()); assertEquals("2", byTag.last().id()); Elements byAt...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test @MultiLocaleTest public void testByAttributeStarting() { Document doc = Jsoup.parse("<div id=1 ATTRIBUTE data-name=jsoup>Hello</div><p data-val=5 id=2>There</p><p id=3>No</p>"); Elements withData = doc.select("[^data-]"); assertEquals(2, withData.size()); assertEquals("1", withData.first().id()); assertEquals("2"...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Override @Test public void shouldGetResultFromResultSetByPosition() throws Exception { byte[] byteArray = new byte[]{1, 2}; when(rs.getBlob(1)).thenReturn(blob); when(rs.wasNull()).thenReturn(false); when(blob.length()).thenReturn((long)byteArray.length); when(blob.getBytes(1, 2)).thenReturn(byteArray); assertThat(TYP...
private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; } }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; } }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; } @Override void setNonNullParameter(P...
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; } @Override void setNonNullParameter(P...
@Test public void descendant() { String h = "<div class=head><p class=first>Hello</p><p>There</p></div><p>None</p>"; Document doc = Jsoup.parse(h); Element root = doc.getElementsByClass("HEAD").first(); Elements els = root.select(".head p"); assertEquals(2, els.size()); assertEquals("Hello", els.get(0).text()); assertE...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testException() throws Exception { thrown.expect(ClassCastException.class); thrown.expectMessage("function[class org.jfaster.mango.invoker.FunctionalSetterInvokerTest$StringToIntegerFunction] on method[void org.jfaster.mango.invoker.FunctionalSetterInvokerTest$E.setX(java.lang.String)] error, method's...
public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); }
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } }
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } private FunctionalSetterInvoker(String name, Method method); }
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } private FunctionalSetterInvoker(String name, Method method); static FunctionalSetterInvoker create(String name, Met...
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } private FunctionalSetterInvoker(String name, Method method); static FunctionalSetterInvoker create(String name, Met...
@Test public void caseInsensitive() { String h = "<dIv tItle=bAr><div>"; Document doc = Jsoup.parse(h); assertEquals(2, doc.select("DiV").size()); assertEquals(1, doc.select("DiV[TiTLE]").size()); assertEquals(1, doc.select("DiV[TiTLE=BAR]").size()); assertEquals(0, doc.select("DiV[TiTLE=BARBARELLA]").size()); }
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testException2() throws Exception { thrown.expect(ClassCastException.class); thrown.expectMessage("function[class org.jfaster.mango.invoker.FunctionalSetterInvokerTest$StringToIntegerListFunction] on method[void org.jfaster.mango.invoker.FunctionalSetterInvokerTest$F.setX(java.util.List)] error, metho...
public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); }
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } }
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } private FunctionalSetterInvoker(String name, Method method); }
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } private FunctionalSetterInvoker(String name, Method method); static FunctionalSetterInvoker create(String name, Met...
FunctionalSetterInvoker extends MethodNamedObject implements SetterInvoker { public static FunctionalSetterInvoker create(String name, Method method) { return new FunctionalSetterInvoker(name, method); } private FunctionalSetterInvoker(String name, Method method); static FunctionalSetterInvoker create(String name, Met...
@Test public void testPseudoHas() { Document doc = Jsoup.parse("<div id=0><p><span>Hello</span></p></div> <div id=1><span class=foo>There</span></div> <div id=2><p>Not</p></div>"); Elements divs1 = doc.select("div:has(span)"); assertEquals(2, divs1.size()); assertEquals("0", divs1.get(0).id()); assertEquals("1", divs1....
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testException() throws Exception { thrown.expect(ClassCastException.class); thrown.expectMessage("function[class org.jfaster.mango.invoker.FunctionalGetterInvokerTest$IntegerToStringFunction] on method[java.lang.String org.jfaster.mango.invoker.FunctionalGetterInvokerTest$E.getX()] error, function's i...
public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); }
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } }
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private FunctionalGetterInvoker(String name, Method method); }
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private FunctionalGetterInvoker(String name, Method method); static FunctionalGetterInvoker create(String name, Met...
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private FunctionalGetterInvoker(String name, Method method); static FunctionalGetterInvoker create(String name, Met...
@Test @MultiLocaleTest public void testPseudoContains() { Document doc = Jsoup.parse("<div><p>The Rain.</p> <p class=light>The <i>RAIN</i>.</p> <p>Rain, the.</p></div>"); Elements ps1 = doc.select("p:contains(Rain)"); assertEquals(3, ps1.size()); Elements ps2 = doc.select("p:contains(the rain)"); assertEquals(2, ps2.si...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test @MultiLocaleTest public void containsOwn() { Document doc = Jsoup.parse("<p id=1>Hello <b>there</b> igor</p>"); Elements ps = doc.select("p:containsOwn(Hello IGOR)"); assertEquals(1, ps.size()); assertEquals("1", ps.first().id()); assertEquals(0, doc.select("p:containsOwn(there)").size()); Document doc2 = Jsoup.p...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testException2() throws Exception { thrown.expect(ClassCastException.class); thrown.expectMessage("function[class org.jfaster.mango.invoker.FunctionalGetterInvokerTest$IntegerListToStringFunction] on method[java.util.List org.jfaster.mango.invoker.FunctionalGetterInvokerTest$F.getX()] error, function'...
public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); }
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } }
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private FunctionalGetterInvoker(String name, Method method); }
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private FunctionalGetterInvoker(String name, Method method); static FunctionalGetterInvoker create(String name, Met...
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private FunctionalGetterInvoker(String name, Method method); static FunctionalGetterInvoker create(String name, Met...
@Test public void testGetType() throws Exception { TypeToken<List<String>> token = new TypeToken<List<String>>() { }; assertThat(token.getType(), equalTo(StringList.class.getGenericInterfaces()[0])); TypeToken<String> token2 = new TypeToken<String>() { }; assertThat(token2.getType().equals(String.class), is(true)); }
public final Type getType() { return runtimeType; }
TypeToken extends TypeCapture<T> implements Serializable { public final Type getType() { return runtimeType; } }
TypeToken extends TypeCapture<T> implements Serializable { public final Type getType() { return runtimeType; } protected TypeToken(); private TypeToken(Type type); }
TypeToken extends TypeCapture<T> implements Serializable { public final Type getType() { return runtimeType; } protected TypeToken(); private TypeToken(Type type); static TypeToken<T> of(Class<T> type); static TypeToken<?> of(Type type); final Class<? super T> getRawType(); final Type getType(); final TypeToken<T> wh...
TypeToken extends TypeCapture<T> implements Serializable { public final Type getType() { return runtimeType; } protected TypeToken(); private TypeToken(Type type); static TypeToken<T> of(Class<T> type); static TypeToken<?> of(Type type); final Class<? super T> getRawType(); final Type getType(); final TypeToken<T> wh...
@Test public void attributeWithBrackets() { String html = "<div data='End]'>One</div> <div data='[Another)]]'>Two</div>"; Document doc = Jsoup.parse(html); assertEquals("One", doc.select("div[data='End]']").first().text()); assertEquals("Two", doc.select("div[data='[Another)]]']").first().text()); assertEquals("One", d...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test @MultiLocaleTest public void containsData() { String html = "<p>function</p><script>FUNCTION</script><style>item</style><span><!-- comments --></span>"; Document doc = Jsoup.parse(html); Element body = doc.body(); Elements dataEls1 = body.select(":containsData(function)"); Elements dataEls2 = body.select("script:...
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void containsWithQuote() { String html = "<p>One'One</p><p>One'Two</p>"; Document doc = Jsoup.parse(html); Elements els = doc.select("p:contains(One\\'One)"); assertEquals(1, els.size()); assertEquals("One'One", els.text()); }
public static Elements select(String query, Element root) { return new Selector(query, root).select(); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); }
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private Selector(String query, Element root); private Selector(Evaluator evaluator, Element root); static Elements select(String query, Element root); static Elements select(Evaluator evaluator, Element...
@Test public void testOrGetsCorrectPrecedence() { Evaluator eval = QueryParser.parse("a b, c d, e f"); assertTrue(eval instanceof CombiningEvaluator.Or); CombiningEvaluator.Or or = (CombiningEvaluator.Or) eval; assertEquals(3, or.evaluators.size()); for (Evaluator innerEval: or.evaluators) { assertTrue(innerEval instan...
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
@Test public void testParsesMultiCorrectly() { Evaluator eval = QueryParser.parse(".foo > ol, ol > li + li"); assertTrue(eval instanceof CombiningEvaluator.Or); CombiningEvaluator.Or or = (CombiningEvaluator.Or) eval; assertEquals(2, or.evaluators.size()); CombiningEvaluator.And andLeft = (CombiningEvaluator.And) or.ev...
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
@Test(expected = Selector.SelectorParseException.class) public void exceptionOnUncloseAttribute() { Evaluator parse = QueryParser.parse("section > a[href=\"]"); }
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
@Test public void testApply() throws Exception { A a = new A(); Method m = A.class.getDeclaredMethod("setX", int[].class); SetterInvoker invoker = FunctionalSetterInvoker.create("x", m); invoker.invoke(a, "1,2,3"); assertThat(Arrays.toString(a.getX()), is(Arrays.toString(new int[]{1, 2, 3}))); invoker.invoke(a, null); ...
@Nullable @Override public int[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new int[0]; } String[] ss = input.split(SEPARATOR); int[] r = new int[ss.length]; for (int i = 0; i < ss.length; i++) { r[i] = Integer.parseInt(ss[i]); } return r; }
StringToIntArrayFunction implements SetterFunction<String, int[]> { @Nullable @Override public int[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new int[0]; } String[] ss = input.split(SEPARATOR); int[] r = new int[ss.length]; for (int i = 0; i < ss.length; i++)...
StringToIntArrayFunction implements SetterFunction<String, int[]> { @Nullable @Override public int[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new int[0]; } String[] ss = input.split(SEPARATOR); int[] r = new int[ss.length]; for (int i = 0; i < ss.length; i++)...
StringToIntArrayFunction implements SetterFunction<String, int[]> { @Nullable @Override public int[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new int[0]; } String[] ss = input.split(SEPARATOR); int[] r = new int[ss.length]; for (int i = 0; i < ss.length; i++)...
StringToIntArrayFunction implements SetterFunction<String, int[]> { @Nullable @Override public int[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new int[0]; } String[] ss = input.split(SEPARATOR); int[] r = new int[ss.length]; for (int i = 0; i < ss.length; i++)...
@Test(expected = Selector.SelectorParseException.class) public void testParsesSingleQuoteInContains() { Evaluator parse = QueryParser.parse("p:contains(One \" One)"); }
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private QueryParser(String query); static Evaluator parse(String query); }
@Test public void handlesBaseUri() { Tag tag = Tag.valueOf("a"); Attributes attribs = new Attributes(); attribs.put("relHref", "/foo"); attribs.put("absHref", "http: Element noBase = new Element(tag, "", attribs); assertEquals("", noBase.absUrl("relHref")); assertEquals("http: Element withBase = new Element(tag, "http:...
public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
@Test public void handleAbsOnFileUris() { Document doc = Jsoup.parse("<a href='password'>One/a><a href='/var/log/messages'>Two</a>", "file:/etc/"); Element one = doc.select("a").first(); assertEquals("file:/etc/password", one.absUrl("href")); Element two = doc.select("a").get(1); assertEquals("file:/var/log/messages", ...
public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
@Test public void handleAbsOnLocalhostFileUris() { Document doc = Jsoup.parse("<a href='password'>One/a><a href='/var/log/messages'>Two</a>", "file: Element one = doc.select("a").first(); assertEquals("file: }
public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
@Test public void absHandlesRelativeQuery() { Document doc = Jsoup.parse("<a href='?foo'>One</a> <a href='bar.html?foo'>Two</a>", "https: Element a1 = doc.select("a").first(); assertEquals("https: Element a2 = doc.select("a").get(1); assertEquals("https: }
public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
@Test public void absHandlesDotFromIndex() { Document doc = Jsoup.parse("<a href='./one/two.html'>One</a>", "http: Element a1 = doc.select("a").first(); assertEquals("http: }
public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); }
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); a...
@Test public void testRemove() { Document doc = Jsoup.parse("<p>One <span>two</span> three</p>"); Element p = doc.select("p").first(); p.childNode(0).remove(); assertEquals("two three", p.text()); assertEquals("<span>two</span> three", TextUtil.stripNewlines(p.html())); }
public void remove() { Validate.notNull(parentNode); parentNode.removeChild(this); }
Node implements Cloneable { public void remove() { Validate.notNull(parentNode); parentNode.removeChild(this); } }
Node implements Cloneable { public void remove() { Validate.notNull(parentNode); parentNode.removeChild(this); } protected Node(); }
Node implements Cloneable { public void remove() { Validate.notNull(parentNode); parentNode.removeChild(this); } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAttr(...
Node implements Cloneable { public void remove() { Validate.notNull(parentNode); parentNode.removeChild(this); } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAttr(...
@Test public void ownerDocument() { Document doc = Jsoup.parse("<p>Hello"); Element p = doc.select("p").first(); assertTrue(p.ownerDocument() == doc); assertTrue(doc.ownerDocument() == doc); assertNull(doc.parent()); }
public Document ownerDocument() { Node root = root(); return (root instanceof Document) ? (Document) root : null; }
Node implements Cloneable { public Document ownerDocument() { Node root = root(); return (root instanceof Document) ? (Document) root : null; } }
Node implements Cloneable { public Document ownerDocument() { Node root = root(); return (root instanceof Document) ? (Document) root : null; } protected Node(); }
Node implements Cloneable { public Document ownerDocument() { Node root = root(); return (root instanceof Document) ? (Document) root : null; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String at...
Node implements Cloneable { public Document ownerDocument() { Node root = root(); return (root instanceof Document) ? (Document) root : null; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String at...
@Test public void root() { Document doc = Jsoup.parse("<div><p>Hello"); Element p = doc.select("p").first(); Node root = p.root(); assertTrue(doc == root); assertNull(root.parent()); assertTrue(doc.root() == doc); assertTrue(doc.root() == doc.ownerDocument()); Element standAlone = new Element(Tag.valueOf("p"), ""); ass...
public Node root() { Node node = this; while (node.parentNode != null) node = node.parentNode; return node; }
Node implements Cloneable { public Node root() { Node node = this; while (node.parentNode != null) node = node.parentNode; return node; } }
Node implements Cloneable { public Node root() { Node node = this; while (node.parentNode != null) node = node.parentNode; return node; } protected Node(); }
Node implements Cloneable { public Node root() { Node node = this; while (node.parentNode != null) node = node.parentNode; return node; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attribut...
Node implements Cloneable { public Node root() { Node node = this; while (node.parentNode != null) node = node.parentNode; return node; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attribut...
@Test public void before() { Document doc = Jsoup.parse("<p>One <b>two</b> three</p>"); Element newNode = new Element(Tag.valueOf("em"), ""); newNode.appendText("four"); doc.select("b").first().before(newNode); assertEquals("<p>One <em>four</em><b>two</b> three</p>", doc.body().html()); doc.select("b").first().before("...
public Node before(String html) { addSiblingHtml(siblingIndex, html); return this; }
Node implements Cloneable { public Node before(String html) { addSiblingHtml(siblingIndex, html); return this; } }
Node implements Cloneable { public Node before(String html) { addSiblingHtml(siblingIndex, html); return this; } protected Node(); }
Node implements Cloneable { public Node before(String html) { addSiblingHtml(siblingIndex, html); return this; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAttr(...
Node implements Cloneable { public Node before(String html) { addSiblingHtml(siblingIndex, html); return this; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAttr(...
@Test public void testApply() throws Exception { A a = new A(); Method m = A.class.getDeclaredMethod("getX"); GetterInvoker invoker = FunctionalGetterInvoker.create("x", m); a.setX(Lists.newArrayList("1", "2", "3")); assertThat((String) invoker.invoke(a), is("1,2,3")); a.setX(null); assertThat(invoker.invoke(a), nullVa...
@Nullable @Override public String apply(@Nullable List<String> input) { if (input == null) { return null; } if (input.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); builder.append(input.get(0)); for (int i = 1; i < input.size(); i++) { builder.append(SEPARATOR).append(input.get(i)); } return b...
StringListToStringFunction implements GetterFunction<List<String>, String> { @Nullable @Override public String apply(@Nullable List<String> input) { if (input == null) { return null; } if (input.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); builder.append(input.get(0)); for (int i = 1; i < in...
StringListToStringFunction implements GetterFunction<List<String>, String> { @Nullable @Override public String apply(@Nullable List<String> input) { if (input == null) { return null; } if (input.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); builder.append(input.get(0)); for (int i = 1; i < in...
StringListToStringFunction implements GetterFunction<List<String>, String> { @Nullable @Override public String apply(@Nullable List<String> input) { if (input == null) { return null; } if (input.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); builder.append(input.get(0)); for (int i = 1; i < in...
StringListToStringFunction implements GetterFunction<List<String>, String> { @Nullable @Override public String apply(@Nullable List<String> input) { if (input == null) { return null; } if (input.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); builder.append(input.get(0)); for (int i = 1; i < in...
@Test public void after() { Document doc = Jsoup.parse("<p>One <b>two</b> three</p>"); Element newNode = new Element(Tag.valueOf("em"), ""); newNode.appendText("four"); doc.select("b").first().after(newNode); assertEquals("<p>One <b>two</b><em>four</em> three</p>", doc.body().html()); doc.select("b").first().after("<i>...
public Node after(String html) { addSiblingHtml(siblingIndex + 1, html); return this; }
Node implements Cloneable { public Node after(String html) { addSiblingHtml(siblingIndex + 1, html); return this; } }
Node implements Cloneable { public Node after(String html) { addSiblingHtml(siblingIndex + 1, html); return this; } protected Node(); }
Node implements Cloneable { public Node after(String html) { addSiblingHtml(siblingIndex + 1, html); return this; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAt...
Node implements Cloneable { public Node after(String html) { addSiblingHtml(siblingIndex + 1, html); return this; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAt...
@Test public void unwrap() { Document doc = Jsoup.parse("<div>One <span>Two <b>Three</b></span> Four</div>"); Element span = doc.select("span").first(); Node twoText = span.childNode(0); Node node = span.unwrap(); assertEquals("<div>One Two <b>Three</b> Four</div>", TextUtil.stripNewlines(doc.body().html())); assertTru...
public Node unwrap() { Validate.notNull(parentNode); final List<Node> childNodes = ensureChildNodes(); Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null; parentNode.addChildren(siblingIndex, this.childNodesAsArray()); this.remove(); return firstChild; }
Node implements Cloneable { public Node unwrap() { Validate.notNull(parentNode); final List<Node> childNodes = ensureChildNodes(); Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null; parentNode.addChildren(siblingIndex, this.childNodesAsArray()); this.remove(); return firstChild; } }
Node implements Cloneable { public Node unwrap() { Validate.notNull(parentNode); final List<Node> childNodes = ensureChildNodes(); Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null; parentNode.addChildren(siblingIndex, this.childNodesAsArray()); this.remove(); return firstChild; } protected Node(); }
Node implements Cloneable { public Node unwrap() { Validate.notNull(parentNode); final List<Node> childNodes = ensureChildNodes(); Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null; parentNode.addChildren(siblingIndex, this.childNodesAsArray()); this.remove(); return firstChild; } protected Node(); ab...
Node implements Cloneable { public Node unwrap() { Validate.notNull(parentNode); final List<Node> childNodes = ensureChildNodes(); Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null; parentNode.addChildren(siblingIndex, this.childNodesAsArray()); this.remove(); return firstChild; } protected Node(); ab...
@Test public void traverse() { Document doc = Jsoup.parse("<div><p>Hello</p></div><div>There</div>"); final StringBuilder accum = new StringBuilder(); doc.select("div").first().traverse(new NodeVisitor() { public void head(Node node, int depth) { accum.append("<" + node.nodeName() + ">"); } public void tail(Node node, ...
public Node traverse(NodeVisitor nodeVisitor) { Validate.notNull(nodeVisitor); NodeTraversor traversor = new NodeTraversor(nodeVisitor); traversor.traverse(this); return this; }
Node implements Cloneable { public Node traverse(NodeVisitor nodeVisitor) { Validate.notNull(nodeVisitor); NodeTraversor traversor = new NodeTraversor(nodeVisitor); traversor.traverse(this); return this; } }
Node implements Cloneable { public Node traverse(NodeVisitor nodeVisitor) { Validate.notNull(nodeVisitor); NodeTraversor traversor = new NodeTraversor(nodeVisitor); traversor.traverse(this); return this; } protected Node(); }
Node implements Cloneable { public Node traverse(NodeVisitor nodeVisitor) { Validate.notNull(nodeVisitor); NodeTraversor traversor = new NodeTraversor(nodeVisitor); traversor.traverse(this); return this; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Att...
Node implements Cloneable { public Node traverse(NodeVisitor nodeVisitor) { Validate.notNull(nodeVisitor); NodeTraversor traversor = new NodeTraversor(nodeVisitor); traversor.traverse(this); return this; } protected Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Att...
@Test public void childNodesCopy() { Document doc = Jsoup.parse("<div id=1>Text 1 <p>One</p> Text 2 <p>Two<p>Three</div><div id=2>"); Element div1 = doc.select("#1").first(); Element div2 = doc.select("#2").first(); List<Node> divChildren = div1.childNodesCopy(); assertEquals(5, divChildren.size()); TextNode tn1 = (Tex...
public List<Node> childNodesCopy() { final List<Node> nodes = ensureChildNodes(); final ArrayList<Node> children = new ArrayList<>(nodes.size()); for (Node node : nodes) { children.add(node.clone()); } return children; }
Node implements Cloneable { public List<Node> childNodesCopy() { final List<Node> nodes = ensureChildNodes(); final ArrayList<Node> children = new ArrayList<>(nodes.size()); for (Node node : nodes) { children.add(node.clone()); } return children; } }
Node implements Cloneable { public List<Node> childNodesCopy() { final List<Node> nodes = ensureChildNodes(); final ArrayList<Node> children = new ArrayList<>(nodes.size()); for (Node node : nodes) { children.add(node.clone()); } return children; } protected Node(); }
Node implements Cloneable { public List<Node> childNodesCopy() { final List<Node> nodes = ensureChildNodes(); final ArrayList<Node> children = new ArrayList<>(nodes.size()); for (Node node : nodes) { children.add(node.clone()); } return children; } protected Node(); abstract String nodeName(); boolean hasParent(); Str...
Node implements Cloneable { public List<Node> childNodesCopy() { final List<Node> nodes = ensureChildNodes(); final ArrayList<Node> children = new ArrayList<>(nodes.size()); for (Node node : nodes) { children.add(node.clone()); } return children; } protected Node(); abstract String nodeName(); boolean hasParent(); Str...
@Test public void changingAttributeValueShouldReplaceExistingAttributeCaseInsensitive() { Document document = Jsoup.parse("<INPUT id=\"foo\" NAME=\"foo\" VALUE=\"\">"); Element inputElement = document.select("#foo").first(); inputElement.attr("value","bar"); assertEquals(singletonAttributes("value", "bar"), getAttribut...
public String attr(String attributeKey) { Validate.notNull(attributeKey); if (!hasAttributes()) return EmptyString; String val = attributes().getIgnoreCase(attributeKey); if (val.length() > 0) return val; else if (attributeKey.startsWith("abs:")) return absUrl(attributeKey.substring("abs:".length())); else return ""; }
Node implements Cloneable { public String attr(String attributeKey) { Validate.notNull(attributeKey); if (!hasAttributes()) return EmptyString; String val = attributes().getIgnoreCase(attributeKey); if (val.length() > 0) return val; else if (attributeKey.startsWith("abs:")) return absUrl(attributeKey.substring("abs:".l...
Node implements Cloneable { public String attr(String attributeKey) { Validate.notNull(attributeKey); if (!hasAttributes()) return EmptyString; String val = attributes().getIgnoreCase(attributeKey); if (val.length() > 0) return val; else if (attributeKey.startsWith("abs:")) return absUrl(attributeKey.substring("abs:".l...
Node implements Cloneable { public String attr(String attributeKey) { Validate.notNull(attributeKey); if (!hasAttributes()) return EmptyString; String val = attributes().getIgnoreCase(attributeKey); if (val.length() > 0) return val; else if (attributeKey.startsWith("abs:")) return absUrl(attributeKey.substring("abs:".l...
Node implements Cloneable { public String attr(String attributeKey) { Validate.notNull(attributeKey); if (!hasAttributes()) return EmptyString; String val = attributes().getIgnoreCase(attributeKey); if (val.length() > 0) return val; else if (attributeKey.startsWith("abs:")) return absUrl(attributeKey.substring("abs:".l...
@Test public void testXhtmlReferences() { Document doc = Jsoup.parse("&lt; &gt; &amp; &quot; &apos; &times;"); doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml); assertEquals("&lt; &gt; &amp; \" ' ×", doc.body().html()); }
public OutputSettings outputSettings() { return outputSettings; }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
@Test public void testClone() { Document doc = Jsoup.parse("<title>Hello</title> <p>One<p>Two"); Document clone = doc.clone(); assertEquals("<html><head><title>Hello</title> </head><body><p>One</p><p>Two</p></body></html>", TextUtil.stripNewlines(clone.html())); clone.title("Hello there"); clone.select("p").first().tex...
@Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; }
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } }
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } Document(String baseUri); }
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void tit...
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void tit...
@Test public void testClonesDeclarations() { Document doc = Jsoup.parse("<!DOCTYPE html><html><head><title>Doctype test"); Document clone = doc.clone(); assertEquals(doc.html(), clone.html()); assertEquals("<!doctype html><html><head><title>Doctype test</title></head><body></body></html>", TextUtil.stripNewlines(clone....
@Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; }
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } }
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } Document(String baseUri); }
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void tit...
Document extends Element { @Override public Document clone() { Document clone = (Document) super.clone(); clone.outputSettings = this.outputSettings.clone(); return clone; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void tit...
@Test public void testLocation() throws IOException { File in = new ParseTest().getFile("/htmltests/yahoo-jp.html"); Document doc = Jsoup.parse(in, "UTF-8", "http: String location = doc.location(); String baseUri = doc.baseUri(); assertEquals("http: assertEquals("http: in = new ParseTest().getFile("/htmltests/nyt-artic...
public String location() { return location; }
Document extends Element { public String location() { return location; } }
Document extends Element { public String location() { return location; } Document(String baseUri); }
Document extends Element { public String location() { return location; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @Override String outer...
Document extends Element { public String location() { return location; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @Override String outer...
@Test public void testHtmlAndXmlSyntax() { String h = "<!DOCTYPE html><body><img async checked='checked' src='&<>\"'>&lt;&gt;&amp;&quot;<foo />bar"; Document doc = Jsoup.parse(h); doc.outputSettings().syntax(Syntax.html); assertEquals("<!doctype html>\n" + "<html>\n" + " <head></head>\n" + " <body>\n" + " <img async ch...
public OutputSettings outputSettings() { return outputSettings; }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
@Test public void testApply() throws Exception { A a = new A(); List<Integer> list = Lists.newArrayList(1, 2, 3); String json = new Gson().toJson(list); Method m = A.class.getDeclaredMethod("setList", List.class); SetterInvoker invoker = FunctionalSetterInvoker.create("list", m); invoker.invoke(a, json); assertThat(a.g...
@Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); } }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); } }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); } @Nullable @Override Object apply(@Nullable String input, Type runtimeOutputTyp...
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); } @Nullable @Override Object apply(@Nullable String input, Type runtimeOutputTyp...
@Test public void htmlParseDefaultsToHtmlOutputSyntax() { Document doc = Jsoup.parse("x"); assertEquals(Syntax.html, doc.outputSettings().syntax()); }
public OutputSettings outputSettings() { return outputSettings; }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
@Test public void testHtmlAppendable() { String htmlContent = "<html><head><title>Hello</title></head><body><p>One</p><p>Two</p></body></html>"; Document document = Jsoup.parse(htmlContent); OutputSettings outputSettings = new OutputSettings(); outputSettings.prettyPrint(false); document.outputSettings(outputSettings);...
public OutputSettings outputSettings() { return outputSettings; }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); }
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...
Document extends Element { public OutputSettings outputSettings() { return outputSettings; } Document(String baseUri); static Document createShell(String baseUri); String location(); Element head(); Element body(); String title(); void title(String title); Element createElement(String tagName); Document normalise(); @O...