/** * Check whether a specified set of mode flags is a superset of this * descriptor's original set of mode flags. * * @param newModes The modes to confirm as superset * @throws org.jruby.util.io.InvalidValueException if the modes are not a superset */ public void checkNewModes(ModeFlags newModes) throws InvalidValueException { if (!newModes.isSubsetOf(originalModes)) { throw new InvalidValueException(); } }
/** * Check whether a specified set of mode flags is a superset of this * descriptor's original set of mode flags. * * @param newModes The modes to confirm as superset * @throws org.jruby.util.io.InvalidValueException if the modes are not a superset */ public void checkNewModes(ModeFlags newModes) throws InvalidValueException { if (!newModes.isSubsetOf(originalModes)) { throw new InvalidValueException(); } }
/** * Check whether a specified set of mode flags is a superset of this * descriptor's original set of mode flags. * * @param newModes The modes to confirm as superset * @throws org.jruby.util.io.InvalidValueException if the modes are not a superset */ public void checkNewModes(ModeFlags newModes) throws InvalidValueException { if (!newModes.isSubsetOf(originalModes)) { throw new InvalidValueException(); } }
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
/** * Check whether a specified set of mode flags is a superset of this * descriptor's original set of mode flags. * * @param newModes The modes to confirm as superset * @throws org.jruby.util.io.InvalidValueException if the modes are not a superset */ public void checkNewModes(ModeFlags newModes) throws InvalidValueException { if (!newModes.isSubsetOf(originalModes)) { throw new InvalidValueException(); } }
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
throw new InvalidValueException(); break; default : throw new InvalidValueException(); break ModifierLoop; default: throw new InvalidValueException();
/** * Construct a new ModeFlags object with the specified flags * * @param flags The flags to use for this object * @throws org.jruby.util.io.InvalidValueException If the modes are invalid */ public ModeFlags(long flags) throws InvalidValueException { // TODO: Ruby does not seem to care about invalid numeric mode values // I am not sure if ruby overflows here also... this.flags = (int)flags; if (isReadOnly() && ((flags & APPEND) != 0)) { // MRI 1.8 behavior: this combination of flags is not allowed throw new InvalidValueException(); } }
/** * Construct a new ModeFlags object with the specified flags * * @param flags The flags to use for this object * @throws org.jruby.util.io.InvalidValueException If the modes are invalid */ public ModeFlags(long flags) throws InvalidValueException { // TODO: Ruby does not seem to care about invalid numeric mode values // I am not sure if ruby overflows here also... this.flags = (int)flags; if (isReadOnly() && ((flags & APPEND) != 0)) { // MRI 1.8 behavior: this combination of flags is not allowed throw new InvalidValueException(); } }
public synchronized void ftruncate(long newLength) throws IOException, BadDescriptorException, InvalidValueException { Channel ch = descriptor.getChannel(); if (!(ch instanceof FileChannel)) { throw new InvalidValueException(); } invalidateBuffer(); FileChannel fileChannel = (FileChannel)ch; long position = fileChannel.position(); if (newLength > fileChannel.size()) { // truncate can't lengthen files, so we save position, seek/write, and go back int difference = (int)(newLength - fileChannel.size()); fileChannel.position(fileChannel.size()); // FIXME: This worries me a bit, since it could allocate a lot with a large newLength fileChannel.write(ByteBuffer.allocate(difference)); } else { fileChannel.truncate(newLength); } fileChannel.position(position); }
public synchronized void ftruncate(long newLength) throws IOException, BadDescriptorException, InvalidValueException { Channel ch = descriptor.getChannel(); if (!(ch instanceof FileChannel)) { throw new InvalidValueException(); } invalidateBuffer(); FileChannel fileChannel = (FileChannel)ch; long position = fileChannel.position(); if (newLength > fileChannel.size()) { // truncate can't lengthen files, so we save position, seek/write, and go back int difference = (int)(newLength - fileChannel.size()); fileChannel.position(fileChannel.size()); // FIXME: This worries me a bit, since it could allocate a lot with a large newLength fileChannel.write(ByteBuffer.allocate(difference)); } else { fileChannel.truncate(newLength); } fileChannel.position(position); }
/** * Construct a new ModeFlags object by parsing the given string * * @param modeString the string * @throws InvalidValueException */ public IOOptions(Ruby runtime, String modeString) throws InvalidValueException { int length = modeString.length(); if (length == 0) { throw new InvalidValueException(); } int colonIndex = modeString.indexOf(':'); if (colonIndex == -1) { modeFlags = new ModeFlags(modeString); } else { modeFlags = new ModeFlags(modeString.substring(0, colonIndex)); } }
/** * Construct a new ModeFlags object by parsing the given string * * @param modeString the string * @throws InvalidValueException */ public IOOptions(Ruby runtime, String modeString) throws InvalidValueException { int length = modeString.length(); if (length == 0) { throw new InvalidValueException(); } int colonIndex = modeString.indexOf(':'); if (colonIndex == -1) { modeFlags = new ModeFlags(modeString); } else { modeFlags = new ModeFlags(modeString.substring(0, colonIndex)); } }
/** * Construct a new ModeFlags object by parsing the given string * * @param modeString the string * @throws InvalidValueException */ public IOOptions(Ruby runtime, String modeString) throws InvalidValueException { int length = modeString.length(); if (length == 0) { throw new InvalidValueException(); } int colonIndex = modeString.indexOf(':'); if (colonIndex == -1) { modeFlags = new ModeFlags(modeString); } else { modeFlags = new ModeFlags(modeString.substring(0, colonIndex)); } }
/** * Construct a new ModeFlags object by parsing the given string * * @param modeString the string * @throws InvalidValueException */ public IOOptions(Ruby runtime, String modeString) throws InvalidValueException { int length = modeString.length(); if (length == 0) { throw new InvalidValueException(); } int colonIndex = modeString.indexOf(':'); if (colonIndex == -1) { modeFlags = new ModeFlags(modeString); } else { modeFlags = new ModeFlags(modeString.substring(0, colonIndex)); } }