Skip to content

Commit

Permalink
add util for ByteBuffer in CommonUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
xinjin committed May 16, 2015
1 parent f77b8bb commit bd2408f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -238,7 +238,7 @@ public void write(int b) throws IOException {
mBuffer.clear();
}

mBuffer.put((byte) (b & 0xFF));
CommonUtils.putIntByteBuffer(mBuffer, b);
mWrittenBytes ++;
}
}
4 changes: 4 additions & 0 deletions common/src/main/java/tachyon/util/CommonUtils.java
Expand Up @@ -360,6 +360,10 @@ public static void printTimeTakenNs(long startTimeNs, Logger logger, String mess
logger.info(message + " took " + (System.nanoTime() - startTimeNs) + " ns.");
}

public static void putIntByteBuffer(ByteBuffer buf, int b) {
buf.put((byte) (b & 0xFF));
}

/**
* If the sticky bit of the 'file' is set, the 'file' is only writable to its owner and the owner
* of the folder containing the 'file'.
Expand Down

0 comments on commit bd2408f

Please sign in to comment.