@Test public void testReadByteBufferNonZip() throws Exception { ByteBuffer byteBuffer = IOUtil.readByteBuffer(getClass().getResource("bytes.out")); assertNotNull(byteBuffer); assertEquals(1, byteBuffer.get()); assertEquals(2, byteBuffer.get()); assertEquals(3, byteBuffer.get()); assertEquals(4, byteBuffer.get()); assertEquals(5, byteBuffer.get()); }
public static ByteBuffer readByteBuffer(URL url) throws IOException { ByteBuffer byteBuffer = null; if (URLUtil.isForResourceWithExtension(url, "zip")) { InputStream is = null; try { is = url.openStream(); ZipRetriever zr = new ZipRetriever(url); byteBuffer = zr.readZipStream(is, url); } catch (Exception e) { String message = "Error loading zip file at '" + url + "': " + e.getLocalizedMessage(); Logging.logger().warning(message); } finally { if (is != null) is.close(); } } if (byteBuffer == null) { byteBuffer = readURLContentToBuffer(url); } return byteBuffer; }
IOUtil extends WWIO { public static ByteBuffer readByteBuffer(URL url) throws IOException { ByteBuffer byteBuffer = null; if (URLUtil.isForResourceWithExtension(url, "zip")) { InputStream is = null; try { is = url.openStream(); ZipRetriever zr = new ZipRetriever(url); byteBuffer = zr.readZipStream(is, url); } catch (Exception e) { String message = "Error loading zip file at '" + url + "': " + e.getLocalizedMessage(); Logging.logger().warning(message); } finally { if (is != null) is.close(); } } if (byteBuffer == null) { byteBuffer = readURLContentToBuffer(url); } return byteBuffer; } }
IOUtil extends WWIO { public static ByteBuffer readByteBuffer(URL url) throws IOException { ByteBuffer byteBuffer = null; if (URLUtil.isForResourceWithExtension(url, "zip")) { InputStream is = null; try { is = url.openStream(); ZipRetriever zr = new ZipRetriever(url); byteBuffer = zr.readZipStream(is, url); } catch (Exception e) { String message = "Error loading zip file at '" + url + "': " + e.getLocalizedMessage(); Logging.logger().warning(message); } finally { if (is != null) is.close(); } } if (byteBuffer == null) { byteBuffer = readURLContentToBuffer(url); } return byteBuffer; }  }
IOUtil extends WWIO { public static ByteBuffer readByteBuffer(URL url) throws IOException { ByteBuffer byteBuffer = null; if (URLUtil.isForResourceWithExtension(url, "zip")) { InputStream is = null; try { is = url.openStream(); ZipRetriever zr = new ZipRetriever(url); byteBuffer = zr.readZipStream(is, url); } catch (Exception e) { String message = "Error loading zip file at '" + url + "': " + e.getLocalizedMessage(); Logging.logger().warning(message); } finally { if (is != null) is.close(); } } if (byteBuffer == null) { byteBuffer = readURLContentToBuffer(url); } return byteBuffer; }  static String readStreamToStringKeepingNewlines(InputStream stream, String encoding); static ByteBuffer readByteBuffer(URL url); static BufferWrapper readByteBuffer(URL url, String pixelType, String byteOrder); static BufferWrapper readByteBuffer(InputStream is, String pixelType, String byteOrder); }
IOUtil extends WWIO { public static ByteBuffer readByteBuffer(URL url) throws IOException { ByteBuffer byteBuffer = null; if (URLUtil.isForResourceWithExtension(url, "zip")) { InputStream is = null; try { is = url.openStream(); ZipRetriever zr = new ZipRetriever(url); byteBuffer = zr.readZipStream(is, url); } catch (Exception e) { String message = "Error loading zip file at '" + url + "': " + e.getLocalizedMessage(); Logging.logger().warning(message); } finally { if (is != null) is.close(); } } if (byteBuffer == null) { byteBuffer = readURLContentToBuffer(url); } return byteBuffer; }  static String readStreamToStringKeepingNewlines(InputStream stream, String encoding); static ByteBuffer readByteBuffer(URL url); static BufferWrapper readByteBuffer(URL url, String pixelType, String byteOrder); static BufferWrapper readByteBuffer(InputStream is, String pixelType, String byteOrder);  }