Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-06-07 11:12:17 +0000
committerAlexander Kurtakov2018-06-07 11:12:17 +0000
commit269a2c076c086071f1d8ac61748d451bc96b9a1d (patch)
treebc3a62f08b988fb505126002b78cc73198fc1a89 /bundles/org.eclipse.equinox.p2.sar/src
parent2f26789ee8d02d33af077a0cc05b133c05ed8b0b (diff)
downloadrt.equinox.p2-269a2c076c086071f1d8ac61748d451bc96b9a1d.tar.gz
rt.equinox.p2-269a2c076c086071f1d8ac61748d451bc96b9a1d.tar.xz
rt.equinox.p2-269a2c076c086071f1d8ac61748d451bc96b9a1d.zip
Bug 535636 - Update bundles to Java 1.8
Take care of p2.sar bundle. Change-Id: I1081d9df9dca93919f79e8e74deeb1133b75e5bd Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.sar/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarInputStream.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarOutputStream.java74
3 files changed, 85 insertions, 87 deletions
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 0de0b4b96..033d3b6e0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,11 +80,12 @@ public class SarEntry extends ZipEntry {
int method = sarInputStream.readInt();
long size = sarInputStream.readLong();
long dosTime = sarInputStream.readLong();
- boolean isEof = sarInputStream.readBoolean();
- boolean isZip = sarInputStream.readBoolean();
+ boolean eof = sarInputStream.readBoolean();
+ boolean zip = 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 + ',' + eof + ',' + zip);
}
if (method == ZipEntry.STORED) {
@@ -97,8 +98,8 @@ public class SarEntry extends ZipEntry {
setExtra(extra);
setMethod(method);
setTime(dosToJavaTime(dosTime));
- setEof(isEof);
- setZip(isZip);
+ setEof(eof);
+ setZip(zip);
}
/**
@@ -114,11 +115,12 @@ public class SarEntry extends ZipEntry {
String name = this.getName();
long size = this.getSize();
long dosTime = javaToDosTime(this.getTime());
- boolean isZip = this.isZip();
- boolean isEof = this.isEof();
+ boolean zip = this.isZip();
+ boolean eof = 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 + ',' + eof + ',' + zip);
}
sarOutputStream.writeString(name);
@@ -129,8 +131,8 @@ public class SarEntry extends ZipEntry {
sarOutputStream.writeInt(method);
sarOutputStream.writeLong(size);
sarOutputStream.writeLong(dosTime);
- sarOutputStream.writeBool(isEof);
- sarOutputStream.writeBool(isZip);
+ sarOutputStream.writeBool(eof);
+ sarOutputStream.writeBool(zip);
}
/**
@@ -164,7 +166,9 @@ public class SarEntry extends ZipEntry {
* Converts DOS time to Java time (number of milliseconds since epoch).
*/
public final static long dosToJavaTime(long dtime) {
- GregorianCalendar cal = new GregorianCalendar((int) (((dtime >> 25) & 0x7f) + 80) + 1900, (int) (((dtime >> 21) & 0x0f) - 1), (int) ((dtime >> 16) & 0x1f), (int) ((dtime >> 11) & 0x1f), (int) ((dtime >> 5) & 0x3f), (int) ((dtime << 1) & 0x3e));
+ GregorianCalendar cal = new GregorianCalendar((int) (((dtime >> 25) & 0x7f) + 80) + 1900,
+ (int) (((dtime >> 21) & 0x0f) - 1), (int) ((dtime >> 16) & 0x1f), (int) ((dtime >> 11) & 0x1f),
+ (int) ((dtime >> 5) & 0x3f), (int) ((dtime << 1) & 0x3e));
return cal.getTime().getTime();
}
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 ea2abef3c..d2b1406d6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,9 +26,8 @@ public class SarInputStream extends InputStream {
/**
* Constructor for SarInputStream.
- *
- * @param inputStream
- * the input stream to use
+ *
+ * @param inputStream the input stream to use
* @throws IOException
*/
public SarInputStream(InputStream inputStream) throws IOException {
@@ -50,29 +49,30 @@ public class SarInputStream extends InputStream {
/**
* Closes this stream.
- *
- * @throws IOException
- * on error
+ *
+ * @throws IOException on error
*/
+ @Override
public void close() throws IOException {
dataInputStream.close();
}
/**
* Since we do not support marking just yet, we return false.
- *
+ *
* @return False.
*/
+ @Override
public boolean markSupported() {
return false;
}
/**
* Since we do not support marking just yet, we do nothing.
- *
- * @param markLimit
- * The limit to mark.
+ *
+ * @param markLimit The limit to mark.
*/
+ @Override
public void mark(int markLimit) {
// nothing
}
@@ -80,21 +80,21 @@ public class SarInputStream extends InputStream {
/**
* Since we do not support marking just yet, we do nothing.
*/
+ @Override
public void reset() {
// nothing
}
/**
* Get the next entry in this org.eclipse.equinox.p2.sar archive. This will skip
- * over any remaining data in the current entry, if there is one, and place
- * the input stream at the header of the next entry, and read the header and
- * instantiate a new SarEntry from the header bytes and return that entry.
- * If there are no more entries in the archive, null will be returned to
- * indicate that the end of the archive has been reached.
- *
+ * over any remaining data in the current entry, if there is one, and place the
+ * input stream at the header of the next entry, and read the header and
+ * instantiate a new SarEntry from the header bytes and return that entry. If
+ * there are no more entries in the archive, null will be returned to indicate
+ * that the end of the archive has been reached.
+ *
* @return the next SarEntry in the archive, or null.
- * @throws IOException
- * on error
+ * @throws IOException on error
*/
public SarEntry getNextEntry() throws IOException {
SarEntry sarEntry = new SarEntry(this);
@@ -109,7 +109,7 @@ public class SarInputStream extends InputStream {
/**
* Close the entry.
- *
+ *
* @throws IOException
*/
public void closeEntry() throws IOException {
@@ -168,34 +168,30 @@ public class SarInputStream extends InputStream {
/**
* Reads a byte from the current tar archive entry.
- *
+ *
* This method simply calls read( byte[], int, int ).
- *
+ *
* @return The byte read, or -1 at EOF.
- * @throws IOException
- * on error
+ * @throws IOException on error
*/
+ @Override
public int read() throws IOException {
return contentStream.read();
}
/**
* Reads bytes from the current tar archive entry.
- *
- * This method is aware of the boundaries of the current entry in the
- * archive and will deal with them as if they were this stream's start and
- * EOF.
- *
- * @param buffer
- * The buffer into which to place bytes read.
- * @param offset
- * The offset at which to place bytes read.
- * @param numToRead
- * The number of bytes to read.
+ *
+ * This method is aware of the boundaries of the current entry in the archive
+ * and will deal with them as if they were this stream's start and EOF.
+ *
+ * @param buffer The buffer into which to place bytes read.
+ * @param offset The offset at which to place bytes read.
+ * @param numToRead The number of bytes to read.
* @return The number of bytes read, or -1 at EOF.
- * @throws IOException
- * on error
+ * @throws IOException on error
*/
+ @Override
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 650a18e7f..c8d2b1c20 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,10 +38,10 @@ public class SarOutputStream extends OutputStream {
/**
* Ends the SAR archive and closes the underlying OutputStream.
- *
+ *
* @see java.io.OutputStream#close()
*/
- // @Override
+ @Override
public void close() throws IOException {
finish();
super.close();
@@ -49,7 +49,7 @@ public class SarOutputStream extends OutputStream {
/**
* Finish this SAR archive but does not close the underlying output stream.
- *
+ *
* @throws IOException
*/
public void finish() throws IOException {
@@ -61,15 +61,14 @@ public class SarOutputStream extends OutputStream {
}
/**
- * Put an entry on the output stream. This writes the entry's header record
- * and positions the output stream for writing the contents of the entry.
- * Once this method is called, the stream is ready for calls to write() to
- * write the entry's contents. Once the contents are written, closeEntry()
- * <B>MUST </B> be called to ensure that all buffered data is completely
- * written to the output stream.
- *
- * @param entry
- * the SarEntry to be written to the archive.
+ * Put an entry on the output stream. This writes the entry's header record and
+ * positions the output stream for writing the contents of the entry. Once this
+ * method is called, the stream is ready for calls to write() to write the
+ * entry's contents. Once the contents are written, closeEntry() <B>MUST </B> be
+ * called to ensure that all buffered data is completely written to the output
+ * stream.
+ *
+ * @param entry the SarEntry to be written to the archive.
* @throws IOException
*/
public void putNextEntry(SarEntry entry) throws IOException {
@@ -77,12 +76,12 @@ public class SarOutputStream extends OutputStream {
}
/**
- * Close an entry. This method MUST be called for all file entries that
- * contain data. The reason is that we must buffer data written to the
- * stream in order to satisfy the buffer's record based writes. Thus, there
- * may be data fragments still being assembled that must be written to the
- * output stream before this entry is closed and the next entry written.
- *
+ * Close an entry. This method MUST be called for all file entries that contain
+ * data. The reason is that we must buffer data written to the stream in order
+ * to satisfy the buffer's record based writes. Thus, there may be data
+ * fragments still being assembled that must be written to the output stream
+ * before this entry is closed and the next entry written.
+ *
* @throws IOException
*/
public void closeEntry() throws IOException {
@@ -149,13 +148,13 @@ public class SarOutputStream extends OutputStream {
/**
* Writes a byte to the current org.eclipse.equinox.p2.sar archive entry.
- *
- * @param b
- * the byte written.
+ *
+ * @param b the byte written.
* @throws IOException
- *
+ *
* @see java.io.OutputStream#write(int)
*/
+ @Override
public void write(int b) throws IOException {
byte[] bytes = new byte[1];
bytes[0] = (byte) b;
@@ -164,38 +163,37 @@ public class SarOutputStream extends OutputStream {
/**
* Writes bytes to the current org.eclipse.equinox.p2.sar archive entry.
- *
- * @param bytes
- * The buffer to write to the archive.
+ *
+ * @param bytes The buffer to write to the archive.
* @throws IOException
- *
+ *
* @see java.io.OutputStream#write(byte[])
*/
+ @Override
public void write(byte[] bytes) throws IOException {
entryContent.write(bytes, 0, bytes.length);
}
/**
* Writes bytes to the current org.eclipse.equinox.p2.sar archive entry.
- *
- * @param bytes
- * The buffer to write to the archive.
- * @param offset
- * The offset in the buffer from which to get bytes.
- * @param numToWrite
- * The number of bytes to write.
- *
+ *
+ * @param bytes The buffer to write to the archive.
+ * @param offset The offset in the buffer from which to get bytes.
+ * @param numToWrite The number of bytes to write.
+ *
* @throws IOException
- *
+ *
* @see java.io.OutputStream#write(byte[], int, int)
*/
+ @Override
public void write(byte[] bytes, int offset, int numToWrite) throws IOException {
entryContent.write(bytes, offset, numToWrite);
}
/**
- * Write an EOF (end of archive) entry to the org.eclipse.equinox.p2.sar archive.
- *
+ * Write an EOF (end of archive) entry to the org.eclipse.equinox.p2.sar
+ * archive.
+ *
* @throws IOException
*/
private void writeEOFRecord() throws IOException {

Back to the top