本文整理汇总了Java中java.io.IOError类的典型用法代码示例。如果您正苦于以下问题:Java IOError类的具体用法?Java IOError怎么用?Java IOError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOError类属于java.io包,在下文中一共展示了IOError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import java.io.IOError; //导入依赖的package包/类
public UnfilteredRowIterator deserialize(DataInputPlus in, int version, CFMetaData metadata, SerializationHelper.Flag flag, Header header) throws IOException
{
if (header.isEmpty)
return EmptyIterators.unfilteredRow(metadata, header.key, header.isReversed);
final SerializationHelper helper = new SerializationHelper(metadata, version, flag);
final SerializationHeader sHeader = header.sHeader;
return new AbstractUnfilteredRowIterator(metadata, header.key, header.partitionDeletion, sHeader.columns(), header.staticRow, header.isReversed, sHeader.stats())
{
private final Row.Builder builder = BTreeRow.sortedBuilder();
protected Unfiltered computeNext()
{
try
{
Unfiltered unfiltered = UnfilteredSerializer.serializer.deserialize(in, sHeader, helper, builder);
return unfiltered == null ? endOfData() : unfiltered;
}
catch (IOException e)
{
throw new IOError(e);
}
}
};
}
示例2: computeNext
import java.io.IOError; //导入依赖的package包/类
protected Unfiltered computeNext()
{
while (true)
{
try
{
if (!deserializer.hasNext())
return endOfData();
Unfiltered unfiltered = deserializer.readNext();
if (metadata.isStaticCompactTable() && unfiltered.kind() == Unfiltered.Kind.ROW)
{
Row row = (Row) unfiltered;
ColumnDefinition def = metadata.getColumnDefinition(LegacyLayout.encodeClustering(metadata, row.clustering()));
if (def != null && def.isStatic())
continue;
}
return unfiltered;
}
catch (IOException e)
{
throw new IOError(e);
}
}
}
示例3: uncaughtException
import java.io.IOError; //导入依赖的package包/类
@Override
public void uncaughtException(Thread t, Throwable e) {
if (isFatalUncaught(e)) {
try {
onFatalUncaught(t.getName(), e);
} finally {
// we use specific error codes in case the above notification failed, at least we
// will have some indication of the error bringing us down
if (e instanceof InternalError) {
halt(128);
} else if (e instanceof OutOfMemoryError) {
halt(127);
} else if (e instanceof StackOverflowError) {
halt(126);
} else if (e instanceof UnknownError) {
halt(125);
} else if (e instanceof IOError) {
halt(124);
} else {
halt(1);
}
}
} else {
onNonFatalUncaught(t.getName(), e);
}
}
示例4: CentralDogmaSecurityManager
import java.io.IOError; //导入依赖的package包/类
public CentralDogmaSecurityManager(File dataDir, Ini securityConfig) {
try {
sessionDao = new FileBasedSessionDAO(new File(dataDir, "_sessions").toPath());
} catch (IOException e) {
throw new IOError(e);
}
sessionManager = new CentralDogmaSessionManager(sessionDao);
final Factory<SecurityManager> factory = new IniSecurityManagerFactory(securityConfig) {
@Override
protected SecurityManager createDefaultInstance() {
DefaultSecurityManager securityManager = new DefaultSecurityManager();
securityManager.setSessionManager(sessionManager);
securityManager.setCacheManager(new MemoryConstrainedCacheManager());
return securityManager;
}
};
delegate = factory.getInstance();
}
示例5: SandboxedPrologContext
import java.io.IOError; //导入依赖的package包/类
/**
* Constructor.
* @param module Working module
*/
public SandboxedPrologContext(Module module) throws IOError
{
this.workingModule = module;
// Load the Mochalog Prolog bridge API into the given
// Prolog context
try
{
// Ignore output from pack_install routine
// TODO: Remove need to force re-upgrade (currently in place due to error logging
prove("pack_install('@A', [interactive(false), silent(true), upgrade(true)])",
PackLoader.getPackResource("mochalog"));
// Build against Mochalog API module
prove("use_module(library(mochalog))");
}
catch (IOException e)
{
throw new IOError(e);
}
}
示例6: getResolvableFilePath
import java.io.IOError; //导入依赖的package包/类
/**
* Convert unvalidated path object to fully validated
* path string.
* @param path Unvalidated file path
* @return Validated path string
* @throws IOException IO error occurred.
*/
public static String getResolvableFilePath(Path path) throws IOException
{
// Ensure valid file path was supplied
if (!Files.exists(path))
{
throw new IOException("Specified file path could not be resolved");
}
try
{
// Convert to absolute path with forward-slash file
// separators
Path absolutePath = path.toAbsolutePath();
return absolutePath.toString().replace('\\', '/');
}
catch (IOError e)
{
throw new IOException("File path could not be converted " +
"to absolute file path.");
}
}
示例7: baseURL
import java.io.IOError; //导入依赖的package包/类
/**
* Returns the base directory or URL for the given URL. Used to implement __DIR__.
* @param url a URL
* @return base path or URL, or null if argument is not a hierarchical URL
*/
public static String baseURL(final URL url) {
try {
final URI uri = url.toURI();
if (uri.getScheme().equals("file")) {
final Path path = Paths.get(uri);
final Path parent = path.getParent();
return (parent != null) ? (parent + File.separator) : null;
}
if (uri.isOpaque() || uri.getPath() == null || uri.getPath().isEmpty()) {
return null;
}
return uri.resolve("").toString();
} catch (final SecurityException | URISyntaxException | IOError e) {
return null;
}
}
示例8: write
import java.io.IOError; //导入依赖的package包/类
@Override
public void write(PropertyMap propertyMap) {
try {
jsonWriter.writeStartObject();
jsonWriter.writeObjectFieldStart("prop");
jsonWriter.writeStartObject();
for (String s : propertyMap.properties.keySet()) {
jsonWriter.writeObjectFieldStart(s);
DataRef ref = propertyMap.properties.get(s);
if(ref instanceof CoreRef) {
((CoreRef) ref).write(this);
} else {
throw new UnsupportedOperationException("Only core properties are supported with PropertyMap!");
}
}
jsonWriter.writeEndObject();
jsonWriter.writeEndObject();
} catch (IOException e) {
throw new IOError(e);
}
}
示例9: writeIntArray
import java.io.IOError; //导入依赖的package包/类
@Override
public void writeIntArray(int[] intValues) {
try {
jsonWriter.writeStartObject();
jsonWriter.writeArrayFieldStart("intarray");
for (int value : intValues) {
jsonWriter.writeNumber(value);
}
jsonWriter.writeEndArray();
jsonWriter.writeEndObject();
} catch (IOException e) {
throw new IOError(e);
}
}
示例10: writeLongArray
import java.io.IOError; //导入依赖的package包/类
@Override
public void writeLongArray(long[] longValues) {
try {
jsonWriter.writeStartObject();
jsonWriter.writeArrayFieldStart("longarray");
for (long value : longValues) {
jsonWriter.writeNumber(value);
}
jsonWriter.writeEndArray();
jsonWriter.writeEndObject();
} catch (IOException e) {
throw new IOError(e);
}
}
示例11: writeDocumentArray
import java.io.IOError; //导入依赖的package包/类
@Override
public void writeDocumentArray(MemoryDocument[] docValues) {
try {
jsonWriter.writeStartObject();
jsonWriter.writeObjectFieldStart("docarray");
jsonWriter.writeStartArray(docValues.length);
for (MemoryDocument document : docValues) {
MemoryJsonLevel0Codec.INSTANCE.encode(document, jsonWriter);
}
jsonWriter.writeEndArray();
jsonWriter.writeEndObject();
jsonWriter.writeEndObject();
} catch (IOException e) {
throw new IOError(e);
}
}
示例12: writeProperties
import java.io.IOError; //导入依赖的package包/类
public void writeProperties(Object2ObjectOpenHashMap<String,DataRef> props) {
try {
writer.writeStartObject();
for (Object2ObjectMap.Entry<String, DataRef> entry : props.object2ObjectEntrySet()) {
writer.writeFieldName(entry.getKey());
if(entry.getValue() instanceof CoreRef) {
CoreRef prop = (CoreRef)(entry.getValue());
prop.write(propwriter);
}
else
throw new UnsupportedOperationException("Only CoreRefs are supported for encoding.");
}
writer.writeEndObject();
} catch (IOException e) {
throw new IOError(e);
}
}
示例13: readPropertySets
import java.io.IOError; //导入依赖的package包/类
private PropertySet[] readPropertySets(PropertyKey[] keys, Int2ObjectOpenHashMap<IntArrayList> pkeyid2setid) {
int numPropertySets = reader.readVarInt(true);
if(numPropertySets < 0)
throw new IOError(new IOException("Failed to read property sets, count is negative: " + numPropertySets));
PropertySet[] propertySets = new PropertySet[numPropertySets];
for(int i = 0; i < numPropertySets; i++) {
int numKeys = reader.readVarInt(true);
PropertyKey[] propertySet = new PropertyKey[numKeys];
for(int k = 0; k < numKeys; k++) {
int pkey;
propertySet[k] = keys[pkey = reader.readVarInt(true)];
getPkey2IdList(pkeyid2setid, pkey).add(i);
}
propertySets[i] = new PropertySet(propertySet);
}
return propertySets;
}
示例14: require
import java.io.IOError; //导入依赖的package包/类
/** @return true if the buffer has been resized. */
protected boolean require (int required) {
if (capacity - position >= required) return false;
if (required > maxCapacity)
throw new IOError(new IOException("Buffer overflow. Max capacity: " + maxCapacity + ", required: " + required));
flush();
while (capacity - position < required) {
if (capacity == maxCapacity)
throw new IOError(new IOException("Buffer overflow. Available: " + (capacity - position) + ", required: " + required));
// Grow buffer.
if (capacity == 0) capacity = 1;
capacity = Math.min(capacity * 2, maxCapacity);
if (capacity < 0) capacity = maxCapacity;
byte[] newBuffer = new byte[capacity];
System.arraycopy(buffer, 0, newBuffer, 0, position);
buffer = newBuffer;
}
return true;
}
示例15: compress
import java.io.IOError; //导入依赖的package包/类
public static byte[] compress(byte[] data) {
try {
//Heuristic, 75% compression.
Output compressed = new Output(32,2147483647);
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressed, 1 << 12);
Output output = new Output(gzipOutputStream);
output.writeVarInt(data.length, true);
output.write(data);
output.close();
return compressed.toBytes();
} catch (IOException e) {
throw new IOError(e);
}
}