0
我有一個程序需要讀取和寫入文件中的RGB值。但是,我遇到了一個應用程序的問題,我從文件中讀取的數據與我正在寫入的數據不同。將字節寫入文件然後讀取會生成不同的字節
程序:
public static void main(String[] args) throws Exception {
FileOutputStream fos = new FileOutputStream(new File("ASDF.txt"));
fos.write(0xFF95999F);
fos.flush();
fos.close();
FileInputStream fis = new FileInputStream(new File("ASDF.txt"));
byte read;
while((read = (byte) fis.read()) != -1) {
System.out.print(String.format("%02X ", read));
}
fis.close();
}
輸出:
9F
空白列表和缺席列表之間有區別。在您提到的情況下返回空列表只適用於cookie標頭沒有值的情況。 – EJP
好吧,我的意思是getCookies(http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29)...請注意,沒有getCookie方法HttpServletRequest這是該API的另一個煩惱。 – Foon