Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2007-12-18 16:30:01 +0000
committerSimon Kaegi2007-12-18 16:30:01 +0000
commitae0c84e7a8a826da0c04735008480de81f8df89f (patch)
tree1713fb72d9e5f838eb10bb1e6953fbcfd1045ecc /bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal
parent71969192304f7ead835080ede71e835cac8b9933 (diff)
downloadrt.equinox.p2-ae0c84e7a8a826da0c04735008480de81f8df89f.tar.gz
rt.equinox.p2-ae0c84e7a8a826da0c04735008480de81f8df89f.tar.xz
rt.equinox.p2-ae0c84e7a8a826da0c04735008480de81f8df89f.zip
Adding project settings and tidying up warnings
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal')
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarConstants.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarInputStream.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarOutputStream.java9
4 files changed, 22 insertions, 36 deletions
diff --git a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarConstants.java b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarConstants.java
index bb70579cb..1dcbb4ddc 100644
--- a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarConstants.java
+++ b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarConstants.java
@@ -7,6 +7,7 @@
*
* Contributors:
* compeople AG (Stefan Liebig) - initial API and implementation
+ * IBM Corporation - bug fixes and enhancements
*******************************************************************************/
package org.eclipse.equinox.internal.p2.sar;
@@ -16,7 +17,7 @@ package org.eclipse.equinox.internal.p2.sar;
public interface SarConstants {
/** <code>SARFILE_MARKER</code> */
- String SARFILE_MARKER = "SarFile";
+ String SARFILE_MARKER = "SarFile"; //$NON-NLS-1$
/** <code>SARFILE_VERSION</code> */
int SARFILE_VERSION = 2;
@@ -24,7 +25,7 @@ public interface SarConstants {
/**
* Comment for <code>DEFAULT_ENCODING</code>
*/
- String DEFAULT_ENCODING = "UTF-8";
+ String DEFAULT_ENCODING = "UTF-8"; //$NON-NLS-1$
/**
* Debug
diff --git a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java
index 89cbd6560..8a2f2730b 100644
--- a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java
+++ b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java
@@ -7,6 +7,7 @@
*
* Contributors:
* compeople AG (Stefan Liebig) - initial API and implementation
+ * IBM Corporation - bug fixes and enhancements
*******************************************************************************/
package org.eclipse.equinox.internal.p2.sar;
@@ -31,7 +32,7 @@ public class SarEntry extends ZipEntry {
/**
* The name of the eof org.eclipse.equinox.p2.sar entry.
*/
- private static final String EOF_ENTRY_NAME = "<eof-org.eclipse.equinox.p2.sar>";
+ private static final String EOF_ENTRY_NAME = "<eof-org.eclipse.equinox.p2.sar>"; //$NON-NLS-1$
private static final boolean DEBUG = SarConstants.DEBUG;
@@ -83,9 +84,7 @@ public class SarEntry extends ZipEntry {
boolean isZip = sarInputStream.readBoolean();
if (DEBUG) {
- System.out.println(getName() + "," + comment + "," + compressedSize
- + "," + crc + "," + extra + "," + method + "," + size + ","
- + dosTime + "," + isEof + "," + isZip);
+ System.out.println(getName() + "," + comment + "," + compressedSize + "," + crc + "," + extra + "," + method + "," + size + "," + dosTime + "," + isEof + "," + isZip);
}
if (method == ZipEntry.STORED) {
@@ -119,9 +118,7 @@ public class SarEntry extends ZipEntry {
boolean isEof = this.isEof();
if (DEBUG) {
- System.out.println(name + "," + comment + "," + compressedSize
- + "," + crc + "," + extra + "," + method + "," + size + ","
- + dosTime + "," + isEof + "," + isZip);
+ System.out.println(name + "," + comment + "," + compressedSize + "," + crc + "," + extra + "," + method + "," + size + "," + dosTime + "," + isEof + "," + isZip);
}
sarOutputStream.writeString(name);
@@ -150,7 +147,7 @@ public class SarEntry extends ZipEntry {
}
/**
- * @return
+ * @return boolean
*/
public boolean isZip() {
return isZip;
@@ -167,10 +164,7 @@ public class SarEntry extends ZipEntry {
* Converts DOS time to Java time (number of milliseconds since epoch).
*/
public final static long dosToJavaTime(long dtime) {
- Date d = new Date((int) (((dtime >> 25) & 0x7f) + 80),
- (int) (((dtime >> 21) & 0x0f) - 1),
- (int) ((dtime >> 16) & 0x1f), (int) ((dtime >> 11) & 0x1f),
- (int) ((dtime >> 5) & 0x3f), (int) ((dtime << 1) & 0x3e));
+ Date d = new Date((int) (((dtime >> 25) & 0x7f) + 80), (int) (((dtime >> 21) & 0x0f) - 1), (int) ((dtime >> 16) & 0x1f), (int) ((dtime >> 11) & 0x1f), (int) ((dtime >> 5) & 0x3f), (int) ((dtime << 1) & 0x3e));
return d.getTime();
}
@@ -183,9 +177,7 @@ public class SarEntry extends ZipEntry {
if (year < 1980) {
return (1 << 21) | (1 << 16);
}
- return (year - 1980) << 25 | (d.getMonth() + 1) << 21
- | d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5
- | d.getSeconds() >> 1;
+ return (year - 1980) << 25 | (d.getMonth() + 1) << 21 | d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 | d.getSeconds() >> 1;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarInputStream.java b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarInputStream.java
index 1d13e1ebc..ea2abef3c 100644
--- a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarInputStream.java
+++ b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarInputStream.java
@@ -7,13 +7,11 @@
*
* Contributors:
* compeople AG (Stefan Liebig) - initial API and implementation
+ * IBM Corporation - bug fixes and enhancements
*******************************************************************************/
package org.eclipse.equinox.internal.p2.sar;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
/**
* The SarInputStream reads a streaming archive as an InputStream. Methods are
@@ -40,8 +38,7 @@ public class SarInputStream extends InputStream {
// SarFile marker
String marker = readString();
if (!marker.equals(SarConstants.SARFILE_MARKER)) {
- throw new IOException(
- "Does not contain org.eclipse.equinox.p2.sar marker.");
+ throw new IOException("Does not contain org.eclipse.equinox.p2.sar marker.");
}
// SarFile version
@@ -120,7 +117,7 @@ public class SarInputStream extends InputStream {
}
/**
- * @return
+ * @return String
* @throws IOException
*/
String readString() throws IOException {
@@ -132,7 +129,7 @@ public class SarInputStream extends InputStream {
}
/**
- * @return
+ * @return byte[]
* @throws IOException
*/
byte[] readBytes() throws IOException {
@@ -146,7 +143,7 @@ public class SarInputStream extends InputStream {
}
/**
- * @return
+ * @return int
* @throws IOException
*/
int readInt() throws IOException {
@@ -154,7 +151,7 @@ public class SarInputStream extends InputStream {
}
/**
- * @return
+ * @return boolean
* @throws IOException
*/
boolean readBoolean() throws IOException {
@@ -162,7 +159,7 @@ public class SarInputStream extends InputStream {
}
/**
- * @return
+ * @return long
* @throws IOException
*/
long readLong() throws IOException {
@@ -199,8 +196,7 @@ public class SarInputStream extends InputStream {
* @throws IOException
* on error
*/
- public int read(byte[] buffer, int offset, int numToRead)
- throws IOException {
+ public int read(byte[] buffer, int offset, int numToRead) throws IOException {
return contentStream.read(buffer, offset, numToRead);
}
diff --git a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarOutputStream.java b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarOutputStream.java
index c63fbdce7..ad3608843 100644
--- a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarOutputStream.java
+++ b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarOutputStream.java
@@ -7,13 +7,11 @@
*
* Contributors:
* compeople AG (Stefan Liebig) - initial API and implementation
+ * IBM Corporation - bug fixes and enhancements
*******************************************************************************/
package org.eclipse.equinox.internal.p2.sar;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
+import java.io.*;
import org.eclipse.equinox.p2.sar.DirectByteArrayOutputStream;
/**
@@ -192,8 +190,7 @@ public class SarOutputStream extends OutputStream {
*
* @see java.io.OutputStream#write(byte[], int, int)
*/
- public void write(byte[] bytes, int offset, int numToWrite)
- throws IOException {
+ public void write(byte[] bytes, int offset, int numToWrite) throws IOException {
entryContent.write(bytes, offset, numToWrite);
}

Back to the top