mirror of https://github.com/apache/lucene.git
- Added ASL and removed trailing spaces.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150094 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
34df355b2d
commit
59779c7455
|
@ -1,4 +1,59 @@
|
|||
package org.apache.lucene.index;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Lucene" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Lucene", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
||||
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.InputStream;
|
||||
import org.apache.lucene.store.OutputStream;
|
||||
|
@ -9,16 +64,20 @@ import java.util.Iterator;
|
|||
import java.io.IOException;
|
||||
|
||||
|
||||
/** Class for accessing a compound stream.
|
||||
/**
|
||||
* Class for accessing a compound stream.
|
||||
* This class implements a directory, but is limited to only read operations.
|
||||
* Directory methods that would normally modify data throw an exception.
|
||||
*
|
||||
* @author Dmitry Serebrennikov
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CompoundFileReader extends Directory {
|
||||
|
||||
private static final class FileEntry {
|
||||
long offset;
|
||||
long length;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Base info
|
||||
|
@ -76,7 +135,6 @@ public class CompoundFileReader extends Directory {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public Directory getDirectory() {
|
||||
return directory;
|
||||
}
|
||||
|
@ -94,7 +152,6 @@ public class CompoundFileReader extends Directory {
|
|||
stream = null;
|
||||
}
|
||||
|
||||
|
||||
public synchronized InputStream openFile(String id)
|
||||
throws IOException
|
||||
{
|
||||
|
@ -108,7 +165,6 @@ public class CompoundFileReader extends Directory {
|
|||
return new CSInputStream(stream, entry.offset, entry.length);
|
||||
}
|
||||
|
||||
|
||||
/** Returns an array of strings, one for each file in the directory. */
|
||||
public String[] list() {
|
||||
String res[] = new String[entries.size()];
|
||||
|
@ -144,7 +200,6 @@ public class CompoundFileReader extends Directory {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** Returns the length of a file in the directory. */
|
||||
public long fileLength(String name)
|
||||
throws IOException
|
||||
|
@ -170,7 +225,6 @@ public class CompoundFileReader extends Directory {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** Implementation of an InputStream that reads from a portion of the
|
||||
* compound file. The visibility is left as "package" *only* because
|
||||
* this helps with testing since JUnit test cases in a different class
|
||||
|
@ -192,7 +246,6 @@ public class CompoundFileReader extends Directory {
|
|||
seekInternal(0); // position to the adjusted 0th byte
|
||||
}
|
||||
|
||||
|
||||
/** Expert: implements buffer refill. Reads bytes from the current
|
||||
* position in the input.
|
||||
* @param b the array to read bytes into
|
||||
|
@ -226,7 +279,6 @@ public class CompoundFileReader extends Directory {
|
|||
base.close();
|
||||
}
|
||||
|
||||
|
||||
/** Returns a clone of this stream.
|
||||
*
|
||||
* <p>Clones of a stream access the same data, and are positioned at the same
|
||||
|
@ -242,6 +294,4 @@ public class CompoundFileReader extends Directory {
|
|||
return other;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,59 @@
|
|||
package org.apache.lucene.index;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Lucene" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Lucene", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
||||
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.OutputStream;
|
||||
import org.apache.lucene.store.InputStream;
|
||||
|
@ -8,7 +63,8 @@ import java.util.Iterator;
|
|||
import java.io.IOException;
|
||||
|
||||
|
||||
/** Combines multiple files into a single compound file.
|
||||
/**
|
||||
* Combines multiple files into a single compound file.
|
||||
* The file format:<br>
|
||||
* <ul>
|
||||
* <li>VInt fileCount</li>
|
||||
|
@ -26,6 +82,9 @@ import java.io.IOException;
|
|||
* file. The {directory} that follows has that many entries. Each directory entry
|
||||
* contains an encoding identifier, an long pointer to the start of this file's
|
||||
* data section, and a UTF String with that file's extension.
|
||||
*
|
||||
* @author Dmitry Serebrennikov
|
||||
* @version $Id$
|
||||
*/
|
||||
final class CompoundFileWriter {
|
||||
|
||||
|
@ -73,7 +132,6 @@ final class CompoundFileWriter {
|
|||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
/** Add a source stream. If sourceDir is null, it is set to the
|
||||
* same value as the directory where this compound stream exists.
|
||||
* The id is the string by which the sub-stream will be know in the
|
||||
|
@ -164,7 +222,6 @@ final class CompoundFileWriter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/** Copy the contents of the file with specified extension into the
|
||||
* provided output stream. Use the provided buffer for moving data
|
||||
* to reduce memory allocation.
|
||||
|
|
Loading…
Reference in New Issue