All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.mmm.util.io.impl.LookaheadByteArrayBufferBuffer Maven / Gradle / Ivy

The newest version!
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0 */
package net.sf.mmm.util.io.impl;

import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

import net.sf.mmm.util.io.api.ByteProcessor;

/**
 * This class is a {@code byte}-Buffer that represents the concatenation of multiple {@link ByteArrayBufferImpl}s. The
 * resulting {@link LookaheadByteArrayBufferBuffer} has its own state and does NOT modify a contained
 * {@link ByteArrayBufferImpl}. 
* ATTENTION:
* This class is NOT intended to be exposed. It should only be used internally by some class or component. * * @author Joerg Hohwiller (hohwille at users.sourceforge.net) * @since 1.0.1 */ public class LookaheadByteArrayBufferBuffer extends AbstractByteArrayBufferBuffer { /** The master buffer adapted by this buffer. */ private final AbstractByteArrayBufferBuffer master; /** * The constructor. * * @param master is the master-buffer to copy for lookahead reads. */ public LookaheadByteArrayBufferBuffer(AbstractByteArrayBufferBuffer master) { super(master); this.master = master; } @Override public byte next() throws NoSuchElementException { sync(this.master); return super.next(); } @Override public boolean hasNext() { sync(this.master); return super.hasNext(); } @Override public long skip(long byteCount) { sync(this.master); return super.skip(byteCount); } @Override public long process(ByteProcessor processor, long byteCount) { sync(this.master); return super.process(processor, byteCount); } @Override protected boolean fill(InputStream inputStream) throws IOException { throw new UnsupportedOperationException(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy