Do not add BinaryCookieReader to exported public API

This commit is contained in:
rcordovano 2019-04-16 17:14:35 -04:00
parent 3f06bdbfc9
commit c799673643

View File

@ -32,15 +32,15 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.recentactivity.BinaryCookieReader.Cookie; import org.sleuthkit.autopsy.recentactivity.BinaryCookieReader.Cookie;
/** /**
* The binary cookie reader encapsulates all the knowledge of how to read the mac * The binary cookie reader encapsulates all the knowledge of how to read the
* .binarycookie files into one class. * mac .binarycookie files into one class.
* *
* The binarycookie file has a header which describes how many pages of cookies * The binarycookie file has a header which describes how many pages of cookies
* and where they are located. Each cookie page has a header and a list of * and where they are located. Each cookie page has a header and a list of
* cookies. * cookies.
* *
*/ */
public final class BinaryCookieReader implements Iterable<Cookie> { final class BinaryCookieReader implements Iterable<Cookie> {
private static final int MAGIC_SIZE = 4; private static final int MAGIC_SIZE = 4;
private static final int SIZEOF_INT_BYTES = 4; private static final int SIZEOF_INT_BYTES = 4;
@ -56,8 +56,8 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
private static final Logger LOG = Logger.getLogger(BinaryCookieReader.class.getName()); private static final Logger LOG = Logger.getLogger(BinaryCookieReader.class.getName());
/** /**
* The binary cookie reader encapsulates all the knowledge of how to read the mac * The binary cookie reader encapsulates all the knowledge of how to read
* .binarycookie files into one class. * the mac .binarycookie files into one class.
* *
*/ */
private BinaryCookieReader(File cookieFile, int[] pageSizeArray) { private BinaryCookieReader(File cookieFile, int[] pageSizeArray) {
@ -96,7 +96,7 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
for (int cnt = 0; cnt < pageCount; cnt++) { for (int cnt = 0; cnt < pageCount; cnt++) {
sizeArray[cnt] = dataStream.readInt(); sizeArray[cnt] = dataStream.readInt();
} }
LOG.log(Level.INFO, "No cookies found in {0}", cookieFile.getName()); //NON-NLS LOG.log(Level.INFO, "No cookies found in {0}", cookieFile.getName()); //NON-NLS
} }
@ -130,16 +130,16 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
* The cookiePageIterator iterates the binarycookie file by page. * The cookiePageIterator iterates the binarycookie file by page.
*/ */
CookiePageIterator() { CookiePageIterator() {
if(pageSizeArray == null || pageSizeArray.length == 0) { if (pageSizeArray == null || pageSizeArray.length == 0) {
return; return;
} }
try { try {
dataStream = new DataInputStream(new FileInputStream(cookieFile)); dataStream = new DataInputStream(new FileInputStream(cookieFile));
// skip to the first page // skip to the first page
dataStream.skipBytes((2 * SIZEOF_INT_BYTES) + (pageSizeArray.length * SIZEOF_INT_BYTES)); dataStream.skipBytes((2 * SIZEOF_INT_BYTES) + (pageSizeArray.length * SIZEOF_INT_BYTES));
} catch (IOException ex) { } catch (IOException ex) {
String errorMessage = String.format("An error occurred creating an input stream for %s", cookieFile.getName()); String errorMessage = String.format("An error occurred creating an input stream for %s", cookieFile.getName());
LOG.log(Level.WARNING, errorMessage, ex); //NON-NLS LOG.log(Level.WARNING, errorMessage, ex); //NON-NLS
closeStream(); // Just incase the error was from skip closeStream(); // Just incase the error was from skip
@ -147,7 +147,7 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
} }
/** /**
* Returns true if there are more cookies in the binarycookie file. * Returns true if there are more cookies in the binarycookie file.
* *
* @return True if there are more cookies * @return True if there are more cookies
*/ */
@ -157,7 +157,7 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
if (dataStream == null) { if (dataStream == null) {
return false; return false;
} }
if (currentIterator == null || !currentIterator.hasNext()) { if (currentIterator == null || !currentIterator.hasNext()) {
try { try {
@ -360,7 +360,7 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
* @return Cookie expiration date in milliseconds with java epoch * @return Cookie expiration date in milliseconds with java epoch
*/ */
public final Long getExpirationDate() { public final Long getExpirationDate() {
return ((long)expirationDate) + MAC_EPOC_FIX; return ((long) expirationDate) + MAC_EPOC_FIX;
} }
/** /**
@ -370,7 +370,7 @@ public final class BinaryCookieReader implements Iterable<Cookie> {
* @return Cookie creation date in milliseconds with java epoch * @return Cookie creation date in milliseconds with java epoch
*/ */
public final Long getCreationDate() { public final Long getCreationDate() {
return ((long)creationDate) + MAC_EPOC_FIX; return ((long) creationDate) + MAC_EPOC_FIX;
} }
/** /**