private final byte[] getFromLog(String dirName, String name) throws IOException { // First searchs in the logs a new value for the object. Object key = OperationKey.newKey(dirName, name); byte[] buf = getFromLog(perThreadContext.get().getLog(), key); if (buf != null) return buf; if (((buf = getFromLog(clog, key)) != null) || ((buf = getFromLog(plog, key)) != null)) { return buf; } return null; }
private final byte[] getFromLog(String dirName, String name) throws IOException { // First searchs in the logs a new value for the object. Object key = OperationKey.newKey(dirName, name); byte[] buf = getFromLog(((Context) perThreadContext.get()).getLog(), key); if (buf != null) return buf; if (((buf = getFromLog(clog, key)) != null) || ((buf = getFromLog(plog, key)) != null)) { return buf; } return null; }
public final byte[] loadByteArray(String dirName, String name) throws IOException { // First searchs in the logs a new value for the object. try { byte[] buf = getFromLog(dirName, name); if (buf != null) return buf; // Gets it from disk. File file; if (dirName == null) { file = new File(dir, name); } else { File parentDir = new File(dir, dirName); file = new File(parentDir, name); } FileInputStream fis = new FileInputStream(file); buf = new byte[(int) file.length()]; for (int nb=0; nb<buf.length; ) { int ret = fis.read(buf, nb, buf.length-nb); if (ret == -1) throw new EOFException(); nb += ret; } fis.close(); return buf; } catch (FileNotFoundException exc) { return null; } }
public final byte[] loadByteArray(String dirName, String name) throws IOException { // First searchs in the logs a new value for the object. try { byte[] buf = getFromLog(dirName, name); if (buf != null) return buf; // Gets it from disk. File file; if (dirName == null) { file = new File(dir, name); } else { File parentDir = new File(dir, dirName); file = new File(parentDir, name); } FileInputStream fis = new FileInputStream(file); buf = new byte[(int) file.length()]; for (int nb=0; nb<buf.length; ) { int ret = fis.read(buf, nb, buf.length-nb); if (ret == -1) throw new EOFException(); nb += ret; } fis.close(); return buf; } catch (FileNotFoundException exc) { return null; } }