equal
deleted
inserted
replaced
363 * connection. |
363 * connection. |
364 * @see java.net.URLConnection#connected |
364 * @see java.net.URLConnection#connected |
365 * @see #getConnectTimeout() |
365 * @see #getConnectTimeout() |
366 * @see #setConnectTimeout(int) |
366 * @see #setConnectTimeout(int) |
367 */ |
367 */ |
368 abstract public void connect() throws IOException; |
368 public abstract void connect() throws IOException; |
369 |
369 |
370 /** |
370 /** |
371 * Sets a specified timeout value, in milliseconds, to be used |
371 * Sets a specified timeout value, in milliseconds, to be used |
372 * when opening a communications link to the resource referenced |
372 * when opening a communications link to the resource referenced |
373 * by this URLConnection. If the timeout expires before the |
373 * by this URLConnection. If the timeout expires before the |
1438 * input stream. |
1438 * input stream. |
1439 * @see java.io.InputStream#mark(int) |
1439 * @see java.io.InputStream#mark(int) |
1440 * @see java.io.InputStream#markSupported() |
1440 * @see java.io.InputStream#markSupported() |
1441 * @see java.net.URLConnection#getContentType() |
1441 * @see java.net.URLConnection#getContentType() |
1442 */ |
1442 */ |
1443 static public String guessContentTypeFromStream(InputStream is) |
1443 public static String guessContentTypeFromStream(InputStream is) |
1444 throws IOException { |
1444 throws IOException { |
1445 // If we can't read ahead safely, just give up on guessing |
1445 // If we can't read ahead safely, just give up on guessing |
1446 if (!is.markSupported()) |
1446 if (!is.markSupported()) |
1447 return null; |
1447 return null; |
1448 |
1448 |
1603 * Check for FlashPix image data in InputStream is. Return true if |
1603 * Check for FlashPix image data in InputStream is. Return true if |
1604 * the stream has FlashPix data, false otherwise. Before calling this |
1604 * the stream has FlashPix data, false otherwise. Before calling this |
1605 * method, the stream should have already been checked to be sure it |
1605 * method, the stream should have already been checked to be sure it |
1606 * contains Microsoft Structured Storage data. |
1606 * contains Microsoft Structured Storage data. |
1607 */ |
1607 */ |
1608 static private boolean checkfpx(InputStream is) throws IOException { |
1608 private static boolean checkfpx(InputStream is) throws IOException { |
1609 |
1609 |
1610 /* Test for FlashPix image data in Microsoft Structured Storage format. |
1610 /* Test for FlashPix image data in Microsoft Structured Storage format. |
1611 * In general, should do this with calls to an SS implementation. |
1611 * In general, should do this with calls to an SS implementation. |
1612 * Lacking that, need to dig via offsets to get to the FlashPix |
1612 * Lacking that, need to dig via offsets to get to the FlashPix |
1613 * ClassID. Details: |
1613 * ClassID. Details: |
1764 /** |
1764 /** |
1765 * Tries to read the specified number of bytes from the stream |
1765 * Tries to read the specified number of bytes from the stream |
1766 * Returns -1, If EOF is reached before len bytes are read, returns 0 |
1766 * Returns -1, If EOF is reached before len bytes are read, returns 0 |
1767 * otherwise |
1767 * otherwise |
1768 */ |
1768 */ |
1769 static private int readBytes(int c[], int len, InputStream is) |
1769 private static int readBytes(int c[], int len, InputStream is) |
1770 throws IOException { |
1770 throws IOException { |
1771 |
1771 |
1772 byte buf[] = new byte[len]; |
1772 byte buf[] = new byte[len]; |
1773 if (is.read(buf, 0, len) < len) { |
1773 if (is.read(buf, 0, len) < len) { |
1774 return -1; |
1774 return -1; |
1785 /** |
1785 /** |
1786 * Skips through the specified number of bytes from the stream |
1786 * Skips through the specified number of bytes from the stream |
1787 * until either EOF is reached, or the specified |
1787 * until either EOF is reached, or the specified |
1788 * number of bytes have been skipped |
1788 * number of bytes have been skipped |
1789 */ |
1789 */ |
1790 static private long skipForward(InputStream is, long toSkip) |
1790 private static long skipForward(InputStream is, long toSkip) |
1791 throws IOException { |
1791 throws IOException { |
1792 |
1792 |
1793 long eachSkip = 0; |
1793 long eachSkip = 0; |
1794 long skipped = 0; |
1794 long skipped = 0; |
1795 |
1795 |