几个笑话 -- 忘恩负义# Joke - 肚皮舞运动
a*7
1 楼
/*
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了。
造福后人吧。
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了。
造福后人吧。