public void mark(int markpos) { markPage = page; byte data[] = new byte[pageFile.getPageSize()]; System.arraycopy(chunk.getData(), 0, data, 0, pageFile.getPageSize()); markChunk = new ByteSequence(data, chunk.getOffset(), chunk.getLength()); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
private ByteSequence chunk = new ByteSequence(new byte[pageFile.getPageSize()]); private Page page = readPage(p); private int pageCount = 1;
DataByteArrayOutputStream out = new DataByteArrayOutputStream(pageFile.getPageSize() * 2) { Page current = copy;
metaData.setFileType(PageFile.class.getName()); metaData.setFileTypeVersion("1"); metaData.setPageSize(getPageSize()); metaData.setCleanShutdown(true); metaData.setFreePages(-1);
final int pageSize = pageFile.getPageSize(); if (pos >= pageSize) {
private Page readPage(Page page) throws IOException { // Read the page data pageFile.readPage(page.getPageId(), chunk.getData()); chunk.setOffset(0); chunk.setLength(pageFile.getPageSize()); DataByteArrayInputStream in = new DataByteArrayInputStream(chunk); page.read(in); chunk.setOffset(Page.PAGE_HEADER_SIZE); if (page.getType() == Page.PAGE_END_TYPE) { chunk.setLength((int)(page.getNext())); } if (page.getType() == Page.PAGE_FREE_TYPE) { throw new EOFException("Chunk stream does not exist, page: " + page.getPageId() + " is marked free"); } return page; }
DataByteArrayOutputStream out = new DataByteArrayOutputStream(pageFile.getPageSize()); page.write(out); write(page, out.getData());
public void mark(int markpos) { markPage = page; byte data[] = new byte[pageFile.getPageSize()]; System.arraycopy(chunk.getData(), 0, data, 0, pageFile.getPageSize()); markChunk = new ByteSequence(data, chunk.getOffset(), chunk.getLength()); }
public void mark(int markpos) { markPage = page; byte data[] = new byte[pageFile.getPageSize()]; System.arraycopy(chunk.getData(), 0, data, 0, pageFile.getPageSize()); markChunk = new ByteSequence(data, chunk.getOffset(), chunk.getLength()); }
public void mark(int markpos) { markPage = page; byte data[] = new byte[pageFile.getPageSize()]; System.arraycopy(chunk.getData(), 0, data, 0, pageFile.getPageSize()); markChunk = new ByteSequence(data, chunk.getOffset(), chunk.getLength()); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
final int pageSize = pageFile.getPageSize(); if (pos >= pageSize) {
private Page readPage(Page page) throws IOException { // Read the page data pageFile.readPage(page.getPageId(), chunk.getData()); chunk.setOffset(0); chunk.setLength(pageFile.getPageSize()); DataByteArrayInputStream in = new DataByteArrayInputStream(chunk); page.read(in); chunk.setOffset(Page.PAGE_HEADER_SIZE); if (page.getType() == Page.PAGE_END_TYPE) { chunk.setLength((int)(page.getNext())); } if (page.getType() == Page.PAGE_FREE_TYPE) { throw new EOFException("Chunk stream does not exist, page: " + page.getPageId() + " is marked free"); } return page; }
private Page readPage(Page page) throws IOException { // Read the page data pageFile.readPage(page.getPageId(), chunk.getData()); chunk.setOffset(0); chunk.setLength(pageFile.getPageSize()); DataByteArrayInputStream in = new DataByteArrayInputStream(chunk); page.read(in); chunk.setOffset(Page.PAGE_HEADER_SIZE); if (page.getType() == Page.PAGE_END_TYPE) { chunk.setLength((int)(page.getNext())); } if (page.getType() == Page.PAGE_FREE_TYPE) { throw new EOFException("Chunk stream does not exist, page: " + page.getPageId() + " is marked free"); } return page; }
private Page readPage(Page page) throws IOException { // Read the page data pageFile.readPage(page.getPageId(), chunk.getData()); chunk.setOffset(0); chunk.setLength(pageFile.getPageSize()); DataByteArrayInputStream in = new DataByteArrayInputStream(chunk); page.read(in); chunk.setOffset(Page.PAGE_HEADER_SIZE); if (page.getType() == Page.PAGE_END_TYPE) { chunk.setLength((int)(page.getNext())); } if (page.getType() == Page.PAGE_FREE_TYPE) { throw new EOFException("Chunk stream does not exist, page: " + page.getPageId() + " is marked free"); } return page; }
DataByteArrayOutputStream out = new DataByteArrayOutputStream(pageFile.getPageSize()); page.write(out); write(page, out.getData());
DataByteArrayOutputStream out = new DataByteArrayOutputStream(pageFile.getPageSize()); page.write(out); write(page, out.getData());