@Override public String toString() { return "[mask=" + Integer.toOctalString(mask) + "]"; }
@Override public void setPermissions(int perms) throws IOException { log.info("permissions = {}", Integer.toOctalString(perms)); }
public static String encodeOctal(final byte[] in) { if (in == null) return ""; final StringBuilder result = new StringBuilder(in.length * 8 / 3); for (final byte element : in) { if ((0Xff & element) < 8) result.append('0'); result.append(Integer.toOctalString(0Xff & element)); } return result.toString(); }
private String getPermString(LocalSourceFile f) throws IOException { return Integer.toOctalString(f.getPermissions() & 07777); }
if (b.length == 1) { final int code = b[0] & 0xFF; sb.append("\\" + Integer.toOctalString(code)); } else { sb.append('?');
@Override public String getValueAsString() { if (isString()) { return (String) this.value; } else if (isInetAddress()) { return InetAddressUtil.toString(this.value); } else if (isFile()) { return this.value.toString(); } else if (isOctal()) { String strVal = Integer.toOctalString(((Integer) this.value).intValue()); if (!strVal.startsWith("0")) { strVal = "0" + strVal; } return strVal; } else if (isArray()) { List list = Arrays.asList((Object[]) this.value); return list.toString(); } else { return this.value.toString(); } }
break; case 'o': r = Integer.toOctalString(x); break; case 'x':
break; case 'o': r = Integer.toOctalString(value & unsignedMask); break; case 'x':
int num = (int)Long.parseLong(text, 8); num += count; number = Integer.toOctalString(num); number = "0" + StringHelper.rightJustify(number, text.length() - 1, '0');
/** * Convert POSIX attributes to property map. * * @param attrs Attributes view. * @return IGFS properties map. */ public static Map<String, String> posixAttributesToMap(PosixFileAttributes attrs) { if (attrs == null) return null; Map<String, String> props = U.newHashMap(3); props.put(IgfsUtils.PROP_USER_NAME, attrs.owner().getName()); props.put(IgfsUtils.PROP_GROUP_NAME, attrs.group().getName()); int perm = 0; for(PosixFilePermission p : attrs.permissions()) perm |= (1 << 8 - p.ordinal()); props.put(IgfsUtils.PROP_PERMISSION, '0' + Integer.toOctalString(perm)); return props; }
/** * Changes the permissions of directory or file with the path specified in args. * * @param path The {@link AlluxioURI} path as the input of the command * @param modeStr The new permission to be updated to the file or directory * @param recursive Whether change the permission recursively */ private void chmod(AlluxioURI path, String modeStr, boolean recursive) throws AlluxioException, IOException { Mode mode = ModeParser.parse(modeStr); SetAttributePOptions options = SetAttributePOptions.newBuilder().setMode(mode.toProto()).setRecursive(recursive).build(); mFileSystem.setAttribute(path, options); System.out .println("Changed permission of " + path + " to " + Integer.toOctalString(mode.toShort())); }
Integer.toOctalString( jobInfo.getOutputSchema().getFields().size())); } else if (ofclass == OrcOutputFormat.class) {
/** {@inheritDoc} */ @Override public String permissions(String path) throws IOException { Path p = path(path); PosixFileAttributeView attrView = Files.getFileAttributeView(p, PosixFileAttributeView.class); if (attrView == null) throw new UnsupportedOperationException("Posix file attributes not available"); int perm = 0; for(PosixFilePermission pfp : attrView.readAttributes().permissions()) perm |= (1 << 8 - pfp.ordinal()); return '0' + Integer.toOctalString(perm); }
int perms = numberPermissions(permissions); if (perms >= 0) { if (!client.sendSiteCommand("chmod " + Integer.toOctalString(perms) + " " + tempFilename)) { logger.warn("Could not set permission on {} to {}", new Object[] {flowFile, permissions});
/** * {@inheritDoc} * <p> * Format this mode as an octal string (for debugging only). */ @Override public String toString() { return Integer.toOctalString(modeBits); }
public class OctalObserver extends Observer{ public OctalObserver(Subject subject){ this.subject = subject; this.subject.attach(this); } @Override public void update() { System.out.println( "Octal String: " + Integer.toOctalString( subject.getState() ) ); }
public static String encodeOctal(final byte[] in) { if (in == null) return ""; final StringBuilder result = new StringBuilder(in.length * 8 / 3); for (final byte element : in) { if ((0Xff & element) < 8) result.append('0'); result.append(Integer.toOctalString(0Xff & element)); } return result.toString(); }
void encodeByteArrayAsEscape(byte[] input, StringBuffer sql) { // escape the into bytea representation StringBuffer sb = new StringBuffer(); for (int i = 0; i < input.length; i++) { byte b = input[i]; if (b == 0) { sb.append("\\\\000"); } else if (b == 39) { sb.append("\\'"); } else if (b == 92) { sb.append("\\\\134'"); } else if (b < 31 || b >= 127) { sb.append("\\\\"); String octal = Integer.toOctalString(b); if (octal.length() == 1) { sb.append("00"); } else if (octal.length() == 2) { sb.append("0"); } sb.append(octal); } else { sb.append((char) b); } } super.encodeValue(sb.toString(), String.class, sql); }
@FunctionName("Oct") @Signature("Oct(number)") @Description( "Returns a Variant (String) representing the octal value of a number.") public static String oct(Object number) { if (number instanceof Number) { return Integer.toOctalString(((Number) number).intValue()); } else { throw new InvalidArgumentException( "Invalid parameter. " + "number parameter " + number + " of Oct function must be " + "of type number"); } }
public static SnapshottableDirectoryStatus.Bean toBean(INodeDirectory d) { return new SnapshottableDirectoryStatus.Bean( d.getFullPathName(), d.getDirectorySnapshottableFeature().getNumSnapshots(), d.getDirectorySnapshottableFeature().getSnapshotQuota(), d.getModificationTime(), Short.valueOf(Integer.toOctalString( d.getFsPermissionShort())), d.getUserName(), d.getGroupName()); }