am 4ca7275b: am 8adc0154: Remove populateOptions(final ByteBuffer buffer).
* commit '4ca7275bd754cc483bb77d0f780dc59d27c70bf4': Remove populateOptions(final ByteBuffer buffer).main
commit
efb38a2314
|
@ -29,7 +29,6 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.BufferUnderflowException;
|
import java.nio.BufferUnderflowException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -358,14 +357,15 @@ class BinaryDictionaryGetter {
|
||||||
try {
|
try {
|
||||||
// Read the version of the file
|
// Read the version of the file
|
||||||
inStream = new FileInputStream(f);
|
inStream = new FileInputStream(f);
|
||||||
final ByteBuffer buffer = inStream.getChannel().map(
|
final BinaryDictInputOutput.ByteBufferWrapper buffer =
|
||||||
FileChannel.MapMode.READ_ONLY, 0, f.length());
|
new BinaryDictInputOutput.ByteBufferWrapper(inStream.getChannel().map(
|
||||||
final int magic = buffer.getInt();
|
FileChannel.MapMode.READ_ONLY, 0, f.length()));
|
||||||
|
final int magic = buffer.readInt();
|
||||||
if (magic != FormatSpec.VERSION_2_MAGIC_NUMBER) {
|
if (magic != FormatSpec.VERSION_2_MAGIC_NUMBER) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int formatVersion = buffer.getInt();
|
final int formatVersion = buffer.readInt();
|
||||||
final int headerSize = buffer.getInt();
|
final int headerSize = buffer.readInt();
|
||||||
final HashMap<String, String> options = CollectionUtils.newHashMap();
|
final HashMap<String, String> options = CollectionUtils.newHashMap();
|
||||||
BinaryDictInputOutput.populateOptions(buffer, headerSize, options);
|
BinaryDictInputOutput.populateOptions(buffer, headerSize, options);
|
||||||
|
|
||||||
|
|
|
@ -1543,11 +1543,6 @@ public class BinaryDictInputOutput {
|
||||||
options.put(key, value);
|
options.put(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: remove this method.
|
|
||||||
public static void populateOptions(final ByteBuffer buffer, final int headerSize,
|
|
||||||
final HashMap<String, String> options) {
|
|
||||||
populateOptions(new ByteBufferWrapper(buffer), headerSize, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a buffer and returns the memory representation of the dictionary.
|
* Reads a buffer and returns the memory representation of the dictionary.
|
||||||
|
|
Loading…
Reference in New Issue