@Override protected ByteBuffer allocateBuffer(long size) { try { return file.channel().map(FileChannel.MapMode.READ_WRITE, 0, size); } catch (IOException ex) { IO.exception(ex); return null; } }
private int fillArray() { try { int x = source.read(buffer); idx = 0; buffLen = x; // Maybe -1 return x; } catch (IOException ex) { IO.exception(ex); return -1; } }
public String get(String url) { String content = null; File file = new File(path, filename(url)); FileInputStream in = null; try { in = new FileInputStream(file); content = IO.readWholeFileAsUTF8(in); } catch (IOException e) { log.error("get({}): {}", url, e.getMessage()); } finally { if (in != null) try { in.close(); } catch (IOException e) { log.error(e.getMessage(), e); } } log.debug("get({}) --> {} bytes", url, content.getBytes().length); return content; }