Wednesday, January 28, 2015

新鲜RocketFuels电面

发信人: again17 (again17), 信区: JobHunting
标  题: 新鲜RocketFuels电面
发信站: BBS 未名空间站 (Tue Jan 27 14:38:11 2015, 美东)



/*
We want to design an object logging module for our users. Objects will be
logged into files. Logging in this context means
saving the serialzied version of the object to a file.

Serialization is 'byte'/'binary' representation of the object.
*/

/* It logs objects into file */
public interface Logger {
   
    public void log(Loggable input); /* this method saves to disk */
   
}

/* Loggable is an object that can be logged */
public interface Loggable {
   
    public byte[] tes(); /* serializer */
   
    public Loggable readBytes(byte[] bytes); /* deserializer */
   
}

/**
Your task is to implement the Logger interface. We dont care about loggable.

Requirements:

1) Take two params in constructor (a) A base file name (b) A size limit
2) As soon as current file > size limit, rotate the file.

What is rotation:

Base file: "some_file.log"
After rotation:
"some_file.log.1" 100MB
"some_file.log.2" 100MB
"some_file.log.3" 100MB

*/


public class MyLogger implements Logger {
   
    // your code goes here.

老印电面,完全不知道在说什么,直接就give up了。
造福后人吧。



--
※ 来源:·WWW 未名空间站 网址:mitbbs.com 移动:在应用商店搜索未名空间·[FROM: 50.]

http://www.mitbbs.com/article_t/JobHunting/32876483.html

No comments:

Post a Comment