You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/04/13 06:06:06 UTC
svn commit: r764356 [10/11] - in /commons/proper/vfs/trunk: ./
core/src/main/java/org/apache/commons/vfs/
core/src/main/java/org/apache/commons/vfs/auth/
core/src/main/java/org/apache/commons/vfs/cache/
core/src/main/java/org/apache/commons/vfs/events/...
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarBuffer.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarBuffer.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarBuffer.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
* io devices. In the Java universe, the only real function that this class
* performs is to ensure that files have the correct "block" size, or other tars
* will complain. <p>
- *
+ * <p/>
* You should never have a need to access this class directly. TarBuffers are
* created by Tar IO Streams.
*
@@ -37,54 +37,54 @@
*/
class TarBuffer
{
- public static final int DEFAULT_RECORDSIZE = ( 512 );
- public static final int DEFAULT_BLOCKSIZE = ( DEFAULT_RECORDSIZE * 20 );
+ public static final int DEFAULT_RECORDSIZE = (512);
+ public static final int DEFAULT_BLOCKSIZE = (DEFAULT_RECORDSIZE * 20);
- private byte[] m_blockBuffer;
- private int m_blockSize;
- private int m_currBlkIdx;
- private int m_currRecIdx;
- private boolean m_debug;
+ private byte[] blockBuffer;
+ private int blockSize;
+ private int currBlkIdx;
+ private int currRecIdx;
+ private boolean debug;
- private InputStream m_input;
- private OutputStream m_output;
- private int m_recordSize;
- private int m_recsPerBlock;
+ private InputStream input;
+ private OutputStream output;
+ private int recordSize;
+ private int recsPerBlock;
- TarBuffer( final InputStream input )
+ TarBuffer(final InputStream input)
{
- this( input, TarBuffer.DEFAULT_BLOCKSIZE );
+ this(input, TarBuffer.DEFAULT_BLOCKSIZE);
}
- TarBuffer( final InputStream input, final int blockSize )
+ TarBuffer(final InputStream input, final int blockSize)
{
- this( input, blockSize, TarBuffer.DEFAULT_RECORDSIZE );
+ this(input, blockSize, TarBuffer.DEFAULT_RECORDSIZE);
}
- TarBuffer( final InputStream input,
- final int blockSize,
- final int recordSize )
+ TarBuffer(final InputStream input,
+ final int blockSize,
+ final int recordSize)
{
- m_input = input;
- initialize( blockSize, recordSize );
+ this.input = input;
+ initialize(blockSize, recordSize);
}
- TarBuffer( final OutputStream output )
+ TarBuffer(final OutputStream output)
{
- this( output, TarBuffer.DEFAULT_BLOCKSIZE );
+ this(output, TarBuffer.DEFAULT_BLOCKSIZE);
}
- TarBuffer( final OutputStream output, final int blockSize )
+ TarBuffer(final OutputStream output, final int blockSize)
{
- this( output, blockSize, TarBuffer.DEFAULT_RECORDSIZE );
+ this(output, blockSize, TarBuffer.DEFAULT_RECORDSIZE);
}
- TarBuffer( final OutputStream output,
- final int blockSize,
- final int recordSize )
+ TarBuffer(final OutputStream output,
+ final int blockSize,
+ final int recordSize)
{
- m_output = output;
- initialize( blockSize, recordSize );
+ this.output = output;
+ initialize(blockSize, recordSize);
}
/**
@@ -92,9 +92,9 @@
*
* @param debug If true, print debugging output.
*/
- public void setDebug( final boolean debug )
+ public void setDebug(final boolean debug)
{
- m_debug = debug;
+ this.debug = debug;
}
/**
@@ -104,7 +104,7 @@
*/
public int getBlockSize()
{
- return m_blockSize;
+ return blockSize;
}
/**
@@ -114,7 +114,7 @@
*/
public int getCurrentBlockNum()
{
- return m_currBlkIdx;
+ return currBlkIdx;
}
/**
@@ -125,7 +125,7 @@
*/
public int getCurrentRecordNum()
{
- return m_currRecIdx - 1;
+ return currRecIdx - 1;
}
/**
@@ -135,7 +135,7 @@
*/
public int getRecordSize()
{
- return m_recordSize;
+ return recordSize;
}
/**
@@ -145,12 +145,12 @@
* @param record The record data to check.
* @return The EOFRecord value
*/
- public boolean isEOFRecord( final byte[] record )
+ public boolean isEOFRecord(final byte[] record)
{
final int size = getRecordSize();
- for( int i = 0; i < size; ++i )
+ for (int i = 0; i < size; ++i)
{
- if( record[ i ] != 0 )
+ if (record[i] != 0)
{
return false;
}
@@ -164,29 +164,29 @@
* block before closing.
*/
public void close()
- throws IOException
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- debug( "TarBuffer.closeBuffer()." );
+ debug("TarBuffer.closeBuffer().");
}
- if( null != m_output )
+ if (null != output)
{
flushBlock();
- if( m_output != System.out && m_output != System.err )
+ if (output != System.out && output != System.err)
{
- m_output.close();
- m_output = null;
+ output.close();
+ output = null;
}
}
- else if( m_input != null )
+ else if (input != null)
{
- if( m_input != System.in )
+ if (input != System.in)
{
- m_input.close();
- m_input = null;
+ input.close();
+ input = null;
}
}
}
@@ -195,40 +195,40 @@
* Read a record from the input stream and return the data.
*
* @return The record data.
- * @exception IOException Description of Exception
+ * @throws IOException Description of Exception
*/
public byte[] readRecord()
- throws IOException
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- final String message = "ReadRecord: recIdx = " + m_currRecIdx +
- " blkIdx = " + m_currBlkIdx;
- debug( message );
+ final String message = "ReadRecord: recIdx = " + currRecIdx +
+ " blkIdx = " + currBlkIdx;
+ debug(message);
}
- if( null == m_input )
+ if (null == input)
{
final String message = "reading from an output buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- if( m_currRecIdx >= m_recsPerBlock )
+ if (currRecIdx >= recsPerBlock)
{
- if( !readBlock() )
+ if (!readBlock())
{
return null;
}
}
- final byte[] result = new byte[ m_recordSize ];
- System.arraycopy( m_blockBuffer,
- ( m_currRecIdx * m_recordSize ),
- result,
- 0,
- m_recordSize );
+ final byte[] result = new byte[recordSize];
+ System.arraycopy(blockBuffer,
+ (currRecIdx * recordSize),
+ result,
+ 0,
+ recordSize);
- m_currRecIdx++;
+ currRecIdx++;
return result;
}
@@ -237,30 +237,30 @@
* Skip over a record on the input stream.
*/
public void skipRecord()
- throws IOException
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- final String message = "SkipRecord: recIdx = " + m_currRecIdx +
- " blkIdx = " + m_currBlkIdx;
- debug( message );
+ final String message = "SkipRecord: recIdx = " + currRecIdx +
+ " blkIdx = " + currBlkIdx;
+ debug(message);
}
- if( null == m_input )
+ if (null == input)
{
final String message = "reading (via skip) from an output buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- if( m_currRecIdx >= m_recsPerBlock )
+ if (currRecIdx >= recsPerBlock)
{
- if( !readBlock() )
+ if (!readBlock())
{
return;// UNDONE
}
}
- m_currRecIdx++;
+ currRecIdx++;
}
/**
@@ -268,42 +268,42 @@
*
* @param record The record data to write to the archive.
*/
- public void writeRecord( final byte[] record )
- throws IOException
+ public void writeRecord(final byte[] record)
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- final String message = "WriteRecord: recIdx = " + m_currRecIdx +
- " blkIdx = " + m_currBlkIdx;
- debug( message );
+ final String message = "WriteRecord: recIdx = " + currRecIdx +
+ " blkIdx = " + currBlkIdx;
+ debug(message);
}
- if( null == m_output )
+ if (null == output)
{
final String message = "writing to an input buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- if( record.length != m_recordSize )
+ if (record.length != recordSize)
{
final String message = "record to write has length '" +
- record.length + "' which is not the record size of '" +
- m_recordSize + "'";
- throw new IOException( message );
+ record.length + "' which is not the record size of '" +
+ recordSize + "'";
+ throw new IOException(message);
}
- if( m_currRecIdx >= m_recsPerBlock )
+ if (currRecIdx >= recsPerBlock)
{
writeBlock();
}
- System.arraycopy( record,
- 0,
- m_blockBuffer,
- ( m_currRecIdx * m_recordSize ),
- m_recordSize );
+ System.arraycopy(record,
+ 0,
+ blockBuffer,
+ (currRecIdx * recordSize),
+ recordSize);
- m_currRecIdx++;
+ currRecIdx++;
}
/**
@@ -313,63 +313,63 @@
* @param buffer The buffer containing the record data to write.
* @param offset The offset of the record data within buf.
*/
- public void writeRecord( final byte[] buffer, final int offset )
- throws IOException
+ public void writeRecord(final byte[] buffer, final int offset)
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- final String message = "WriteRecord: recIdx = " + m_currRecIdx +
- " blkIdx = " + m_currBlkIdx;
- debug( message );
+ final String message = "WriteRecord: recIdx = " + currRecIdx +
+ " blkIdx = " + currBlkIdx;
+ debug(message);
}
- if( null == m_output )
+ if (null == output)
{
final String message = "writing to an input buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- if( ( offset + m_recordSize ) > buffer.length )
+ if ((offset + recordSize) > buffer.length)
{
final String message = "record has length '" + buffer.length +
- "' with offset '" + offset + "' which is less than the record size of '" +
- m_recordSize + "'";
- throw new IOException( message );
+ "' with offset '" + offset + "' which is less than the record size of '" +
+ recordSize + "'";
+ throw new IOException(message);
}
- if( m_currRecIdx >= m_recsPerBlock )
+ if (currRecIdx >= recsPerBlock)
{
writeBlock();
}
- System.arraycopy( buffer,
- offset,
- m_blockBuffer,
- ( m_currRecIdx * m_recordSize ),
- m_recordSize );
+ System.arraycopy(buffer,
+ offset,
+ blockBuffer,
+ (currRecIdx * recordSize),
+ recordSize);
- m_currRecIdx++;
+ currRecIdx++;
}
/**
* Flush the current data block if it has any data in it.
*/
private void flushBlock()
- throws IOException
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
final String message = "TarBuffer.flushBlock() called.";
- debug( message );
+ debug(message);
}
- if( m_output == null )
+ if (output == null)
{
final String message = "writing to an input buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- if( m_currRecIdx > 0 )
+ if (currRecIdx > 0)
{
writeBlock();
}
@@ -378,23 +378,23 @@
/**
* Initialization common to all constructors.
*/
- private void initialize( final int blockSize, final int recordSize )
+ private void initialize(final int blockSize, final int recordSize)
{
- m_debug = false;
- m_blockSize = blockSize;
- m_recordSize = recordSize;
- m_recsPerBlock = ( m_blockSize / m_recordSize );
- m_blockBuffer = new byte[ m_blockSize ];
+ debug = false;
+ this.blockSize = blockSize;
+ this.recordSize = recordSize;
+ recsPerBlock = (this.blockSize / this.recordSize);
+ blockBuffer = new byte[this.blockSize];
- if( null != m_input )
+ if (null != input)
{
- m_currBlkIdx = -1;
- m_currRecIdx = m_recsPerBlock;
+ currBlkIdx = -1;
+ currRecIdx = recsPerBlock;
}
else
{
- m_currBlkIdx = 0;
- m_currRecIdx = 0;
+ currBlkIdx = 0;
+ currRecIdx = 0;
}
}
@@ -402,28 +402,28 @@
* @return false if End-Of-File, else true
*/
private boolean readBlock()
- throws IOException
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- final String message = "ReadBlock: blkIdx = " + m_currBlkIdx;
- debug( message );
+ final String message = "ReadBlock: blkIdx = " + currBlkIdx;
+ debug(message);
}
- if( null == m_input )
+ if (null == input)
{
final String message = "reading from an output buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- m_currRecIdx = 0;
+ currRecIdx = 0;
int offset = 0;
- int bytesNeeded = m_blockSize;
+ int bytesNeeded = blockSize;
- while( bytesNeeded > 0 )
+ while (bytesNeeded > 0)
{
- final long numBytes = m_input.read( m_blockBuffer, offset, bytesNeeded );
+ final long numBytes = input.read(blockBuffer, offset, bytesNeeded);
//
// NOTE
@@ -438,7 +438,7 @@
//
// Thanks to 'Yohann.Roussel@alcatel.fr' for this fix.
//
- if( numBytes == -1 )
+ if (numBytes == -1)
{
// However, just leaving the unread portion of the buffer dirty does
// cause problems in some cases. This problem is described in
@@ -446,7 +446,7 @@
//
// The solution is to fill the unused portion of the buffer with zeros.
- Arrays.fill(m_blockBuffer, offset, offset + bytesNeeded, (byte) 0);
+ Arrays.fill(blockBuffer, offset, offset + bytesNeeded, (byte) 0);
break;
}
@@ -454,18 +454,18 @@
offset += numBytes;
bytesNeeded -= numBytes;
- if( numBytes != m_blockSize )
+ if (numBytes != blockSize)
{
- if( m_debug )
+ if (debug)
{
- System.err.println( "ReadBlock: INCOMPLETE READ "
- + numBytes + " of " + m_blockSize
- + " bytes read." );
+ System.err.println("ReadBlock: INCOMPLETE READ "
+ + numBytes + " of " + blockSize
+ + " bytes read.");
}
}
}
- m_currBlkIdx++;
+ currBlkIdx++;
return true;
}
@@ -473,35 +473,35 @@
/**
* Write a TarBuffer block to the archive.
*
- * @exception IOException Description of Exception
+ * @throws IOException Description of Exception
*/
private void writeBlock()
- throws IOException
+ throws IOException
{
- if( m_debug )
+ if (debug)
{
- final String message = "WriteBlock: blkIdx = " + m_currBlkIdx;
- debug( message );
+ final String message = "WriteBlock: blkIdx = " + currBlkIdx;
+ debug(message);
}
- if( null == m_output )
+ if (null == output)
{
final String message = "writing to an input buffer";
- throw new IOException( message );
+ throw new IOException(message);
}
- m_output.write( m_blockBuffer, 0, m_blockSize );
- m_output.flush();
+ output.write(blockBuffer, 0, blockSize);
+ output.flush();
- m_currRecIdx = 0;
- m_currBlkIdx++;
+ currRecIdx = 0;
+ currBlkIdx++;
}
- protected void debug( final String message )
+ protected void debug(final String message)
{
- if( m_debug )
+ if (debug)
{
- System.err.println( message );
+ System.err.println(message);
}
}
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarConstants.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarConstants.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarConstants.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarEntry.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarEntry.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarEntry.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,24 +24,24 @@
* This class represents an entry in a Tar archive. It consists of the entry's
* header, as well as the entry's File. Entries can be instantiated in one of
* three ways, depending on how they are to be used. <p>
- *
+ * <p/>
* TarEntries that are created from the header bytes read from an archive are
* instantiated with the TarEntry( byte[] ) constructor. These entries will be
* used when extracting from or listing the contents of an archive. These
* entries have their header filled in using the header bytes. They also set the
* File to null, since they reference an archive entry not a file. <p>
- *
+ * <p/>
* TarEntries that are created from Files that are to be written into an archive
* are instantiated with the TarEntry( File ) constructor. These entries have
* their header filled in using the File's information. They also keep a
* reference to the File for convenience when writing entries. <p>
- *
+ * <p/>
* Finally, TarEntries can be constructed from nothing but a name. This allows
* the programmer to construct the entry by hand, for instance when only an
* InputStream is available for writing to the archive, and the header
* information is constructed from other information. In this case the header
* fields are set to defaults and the File is set to null. <p>
- *
+ * <p/>
* The C structure for a Tar Entry's header is: <pre>
* struct header {
* char name[NAMSIZ];
@@ -66,7 +66,6 @@
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Revision$ $Date$
* @see TarInputStream
- * @see TarOutputStream
*/
class TarEntry
{
@@ -78,74 +77,74 @@
/**
* The entry's modification time.
*/
- private int m_checkSum;
+ private int checkSum;
/**
* The entry's group name.
*/
- private int m_devMajor;
+ private int devMajor;
/**
* The entry's major device number.
*/
- private int m_devMinor;
+ private int devMinor;
/**
* The entry's minor device number.
*/
- private File m_file;
+ private File file;
/**
* The entry's user id.
*/
- private int m_groupID;
+ private int groupID;
/**
* The entry's user name.
*/
- private StringBuffer m_groupName;
+ private StringBuffer groupName;
/**
* The entry's checksum.
*/
- private byte m_linkFlag;
+ private byte linkFlag;
/**
* The entry's link flag.
*/
- private StringBuffer m_linkName;
+ private StringBuffer linkName;
/**
* The entry's link name.
*/
- private StringBuffer m_magic;
+ private StringBuffer magic;
/**
* The entry's size.
*/
- private long m_modTime;
+ private long modTime;
/**
* The entry's name.
*/
- private int m_mode;
+ private int mode;
- private StringBuffer m_name;
+ private StringBuffer name;
/**
* The entry's group id.
*/
- private long m_size;
+ private long size;
/**
* The entry's permission mode.
*/
- private int m_userID;
+ private int userID;
/**
* The entry's magic tag.
*/
- private StringBuffer m_userName;
+ private StringBuffer userName;
/**
* Construct an entry with only a name. This allows the programmer to
@@ -153,31 +152,31 @@
*
* @param name the name of the entry
*/
- TarEntry( final String name )
+ TarEntry(final String name)
{
this();
- final boolean isDir = name.endsWith( "/" );
+ final boolean isDir = name.endsWith("/");
- m_name = new StringBuffer( name );
- m_mode = isDir ? 040755 : 0100644;
- m_linkFlag = isDir ? TarConstants.LF_DIR : TarConstants.LF_NORMAL;
- m_modTime = ( new Date() ).getTime() / 1000;
- m_linkName = new StringBuffer( "" );
- m_userName = new StringBuffer( "" );
- m_groupName = new StringBuffer( "" );
+ this.name = new StringBuffer(name);
+ mode = isDir ? 040755 : 0100644;
+ linkFlag = isDir ? TarConstants.LF_DIR : TarConstants.LF_NORMAL;
+ modTime = (new Date()).getTime() / 1000;
+ linkName = new StringBuffer("");
+ userName = new StringBuffer("");
+ groupName = new StringBuffer("");
}
/**
* Construct an entry with a name an a link flag.
*
- * @param name Description of Parameter
+ * @param name Description of Parameter
* @param linkFlag Description of Parameter
*/
- TarEntry( final String name, final byte linkFlag )
+ TarEntry(final String name, final byte linkFlag)
{
- this( name );
- m_linkFlag = linkFlag;
+ this(name);
+ this.linkFlag = linkFlag;
}
/**
@@ -186,75 +185,75 @@
*
* @param file The file that the entry represents.
*/
- TarEntry( final File file )
+ TarEntry(final File file)
{
this();
- m_file = file;
+ this.file = file;
String name = file.getPath();
// Strip off drive letters!
final String osName =
- System.getProperty( "os.name" ).toLowerCase( Locale.US );
- if( -1 != osName.indexOf( "netware" ) )
+ System.getProperty("os.name").toLowerCase(Locale.US);
+ if (-1 != osName.indexOf("netware"))
{
- if( name.length() > 2 )
+ if (name.length() > 2)
{
- final char ch1 = name.charAt( 0 );
- final char ch2 = name.charAt( 1 );
+ final char ch1 = name.charAt(0);
+ final char ch2 = name.charAt(1);
- if( ch2 == ':' &&
- ( ( ch1 >= 'a' && ch1 <= 'z' ) ||
- ( ch1 >= 'A' && ch1 <= 'Z' ) ) )
+ if (ch2 == ':' &&
+ ((ch1 >= 'a' && ch1 <= 'z') ||
+ (ch1 >= 'A' && ch1 <= 'Z')))
{
- name = name.substring( 2 );
+ name = name.substring(2);
}
}
}
- else if( -1 != osName.indexOf( "netware" ) )
+ else if (-1 != osName.indexOf("netware"))
{
- final int colon = name.indexOf( ':' );
- if( colon != -1 )
+ final int colon = name.indexOf(':');
+ if (colon != -1)
{
- name = name.substring( colon + 1 );
+ name = name.substring(colon + 1);
}
}
- name = name.replace( File.separatorChar, '/' );
+ name = name.replace(File.separatorChar, '/');
// No absolute pathnames
// Windows (and Posix?) paths can start with "\\NetworkDrive\",
// so we loop on starting /'s.
- while( name.startsWith( "/" ) )
+ while (name.startsWith("/"))
{
- name = name.substring( 1 );
+ name = name.substring(1);
}
- m_linkName = new StringBuffer( "" );
- m_name = new StringBuffer( name );
+ linkName = new StringBuffer("");
+ this.name = new StringBuffer(name);
- if( file.isDirectory() )
+ if (file.isDirectory())
{
- m_mode = 040755;
- m_linkFlag = TarConstants.LF_DIR;
+ mode = 040755;
+ linkFlag = TarConstants.LF_DIR;
- if( m_name.charAt( m_name.length() - 1 ) != '/' )
+ if (this.name.charAt(this.name.length() - 1) != '/')
{
- m_name.append( "/" );
+ this.name.append("/");
}
}
else
{
- m_mode = 0100644;
- m_linkFlag = TarConstants.LF_NORMAL;
+ mode = 0100644;
+ linkFlag = TarConstants.LF_NORMAL;
}
- m_size = file.length();
- m_modTime = file.lastModified() / 1000;
- m_checkSum = 0;
- m_devMajor = 0;
- m_devMinor = 0;
+ size = file.length();
+ modTime = file.lastModified() / 1000;
+ checkSum = 0;
+ devMajor = 0;
+ devMinor = 0;
}
/**
@@ -262,10 +261,10 @@
*
* @param header The header bytes from a tar archive entry.
*/
- TarEntry( final byte[] header )
+ TarEntry(final byte[] header)
{
this();
- parseTarHeader( header );
+ parseTarHeader(header);
}
/**
@@ -273,18 +272,18 @@
*/
private TarEntry()
{
- m_magic = new StringBuffer( TarConstants.TMAGIC );
- m_name = new StringBuffer();
- m_linkName = new StringBuffer();
+ magic = new StringBuffer(TarConstants.TMAGIC);
+ name = new StringBuffer();
+ linkName = new StringBuffer();
- String user = System.getProperty( "user.name", "" );
- if( user.length() > 31 )
+ String user = System.getProperty("user.name", "");
+ if (user.length() > 31)
{
- user = user.substring( 0, 31 );
+ user = user.substring(0, 31);
}
- m_userName = new StringBuffer( user );
- m_groupName = new StringBuffer( "" );
+ userName = new StringBuffer(user);
+ groupName = new StringBuffer("");
}
/**
@@ -292,21 +291,21 @@
*
* @param groupId This entry's new group id.
*/
- public void setGroupID( final int groupId )
+ public void setGroupID(final int groupId)
{
- m_groupID = groupId;
+ groupID = groupId;
}
/**
* Set this entry's group id.
*
* @param groupId This entry's new group id.
- * @deprecated Use setGroupID() instead
* @see #setGroupID(int)
+ * @deprecated Use setGroupID() instead
*/
- public void setGroupId( final int groupId )
+ public void setGroupId(final int groupId)
{
- m_groupID = groupId;
+ groupID = groupId;
}
/**
@@ -314,9 +313,9 @@
*
* @param groupName This entry's new group name.
*/
- public void setGroupName( final String groupName )
+ public void setGroupName(final String groupName)
{
- m_groupName = new StringBuffer( groupName );
+ this.groupName = new StringBuffer(groupName);
}
/**
@@ -325,9 +324,9 @@
*
* @param time This entry's new modification time.
*/
- public void setModTime( final long time )
+ public void setModTime(final long time)
{
- m_modTime = time / 1000;
+ modTime = time / 1000;
}
/**
@@ -335,9 +334,9 @@
*
* @param time This entry's new modification time.
*/
- public void setModTime( final Date time )
+ public void setModTime(final Date time)
{
- m_modTime = time.getTime() / 1000;
+ modTime = time.getTime() / 1000;
}
/**
@@ -345,9 +344,9 @@
*
* @param mode The new Mode value
*/
- public void setMode( final int mode )
+ public void setMode(final int mode)
{
- m_mode = mode;
+ this.mode = mode;
}
/**
@@ -355,9 +354,9 @@
*
* @param name This entry's new name.
*/
- public void setName( final String name )
+ public void setName(final String name)
{
- m_name = new StringBuffer( name );
+ this.name = new StringBuffer(name);
}
/**
@@ -365,9 +364,9 @@
*
* @param size This entry's new file size.
*/
- public void setSize( final long size )
+ public void setSize(final long size)
{
- m_size = size;
+ this.size = size;
}
/**
@@ -375,21 +374,21 @@
*
* @param userId This entry's new user id.
*/
- public void setUserID( final int userId )
+ public void setUserID(final int userId)
{
- m_userID = userId;
+ userID = userId;
}
/**
* Set this entry's user id.
*
* @param userId This entry's new user id.
- * @deprecated Use setUserID() instead
* @see #setUserID(int)
+ * @deprecated Use setUserID() instead
*/
- public void setUserId( final int userId )
+ public void setUserId(final int userId)
{
- m_userID = userId;
+ userID = userId;
}
/**
@@ -397,9 +396,9 @@
*
* @param userName This entry's new user name.
*/
- public void setUserName( final String userName )
+ public void setUserName(final String userName)
{
- m_userName = new StringBuffer( userName );
+ this.userName = new StringBuffer(userName);
}
/**
@@ -410,17 +409,17 @@
*/
public TarEntry[] getDirectoryEntries()
{
- if( null == m_file || !m_file.isDirectory() )
+ if (null == file || !file.isDirectory())
{
- return new TarEntry[ 0 ];
+ return new TarEntry[0];
}
- final String[] list = m_file.list();
- final TarEntry[] result = new TarEntry[ list.length ];
+ final String[] list = file.list();
+ final TarEntry[] result = new TarEntry[list.length];
- for( int i = 0; i < list.length; ++i )
+ for (int i = 0; i < list.length; ++i)
{
- result[ i ] = new TarEntry( new File( m_file, list[ i ] ) );
+ result[i] = new TarEntry(new File(file, list[i]));
}
return result;
@@ -433,19 +432,19 @@
*/
public File getFile()
{
- return m_file;
+ return file;
}
/**
* Get this entry's group id.
*
* @return This entry's group id.
- * @deprecated Use getGroupID() instead
* @see #getGroupID()
+ * @deprecated Use getGroupID() instead
*/
public int getGroupId()
{
- return m_groupID;
+ return groupID;
}
/**
@@ -455,7 +454,7 @@
*/
public int getGroupID()
{
- return m_groupID;
+ return groupID;
}
/**
@@ -465,7 +464,7 @@
*/
public String getGroupName()
{
- return m_groupName.toString();
+ return groupName.toString();
}
/**
@@ -475,7 +474,7 @@
*/
public Date getModTime()
{
- return new Date( m_modTime * 1000 );
+ return new Date(modTime * 1000);
}
/**
@@ -485,7 +484,7 @@
*/
public int getMode()
{
- return m_mode;
+ return mode;
}
/**
@@ -495,7 +494,7 @@
*/
public String getName()
{
- return m_name.toString();
+ return name.toString();
}
/**
@@ -505,7 +504,7 @@
*/
public long getSize()
{
- return m_size;
+ return size;
}
/**
@@ -515,19 +514,19 @@
*/
public int getCheckSum()
{
- return m_checkSum;
+ return checkSum;
}
/**
* Get this entry's user id.
*
* @return This entry's user id.
- * @deprecated Use getUserID() instead
* @see #getUserID()
+ * @deprecated Use getUserID() instead
*/
public int getUserId()
{
- return m_userID;
+ return userID;
}
/**
@@ -537,7 +536,7 @@
*/
public int getUserID()
{
- return m_userID;
+ return userID;
}
/**
@@ -547,7 +546,7 @@
*/
public String getUserName()
{
- return m_userName.toString();
+ return userName.toString();
}
/**
@@ -558,9 +557,9 @@
* @param desc Entry to be checked as a descendent of
* @return True if entry is a descendant of
*/
- public boolean isDescendent( final TarEntry desc )
+ public boolean isDescendent(final TarEntry desc)
{
- return desc.getName().startsWith( getName() );
+ return desc.getName().startsWith(getName());
}
/**
@@ -570,17 +569,17 @@
*/
public boolean isDirectory()
{
- if( m_file != null )
+ if (file != null)
{
- return m_file.isDirectory();
+ return file.isDirectory();
}
- if( m_linkFlag == TarConstants.LF_DIR )
+ if (linkFlag == TarConstants.LF_DIR)
{
return true;
}
- if( getName().endsWith( "/" ) )
+ if (getName().endsWith("/"))
{
return true;
}
@@ -595,8 +594,8 @@
*/
public boolean isGNULongNameEntry()
{
- return m_linkFlag == TarConstants.LF_GNUTYPE_LONGNAME &&
- m_name.toString().equals( TarConstants.GNU_LONGLINK );
+ return linkFlag == TarConstants.LF_GNUTYPE_LONGNAME &&
+ name.toString().equals(TarConstants.GNU_LONGLINK);
}
/**
@@ -606,9 +605,9 @@
* @param other Entry to be checked for equality.
* @return True if the entries are equal.
*/
- public boolean equals( final TarEntry other )
+ public boolean equals(final TarEntry other)
{
- return getName().equals( other.getName() );
+ return getName().equals(other.getName());
}
/**
@@ -616,36 +615,36 @@
*
* @param header The tar entry header buffer to get information from.
*/
- private void parseTarHeader( final byte[] header )
+ private void parseTarHeader(final byte[] header)
{
int offset = 0;
- m_name = TarUtils.parseName( header, offset, NAMELEN );
+ name = TarUtils.parseName(header, offset, NAMELEN);
offset += NAMELEN;
- m_mode = (int)TarUtils.parseOctal( header, offset, TarConstants.MODELEN );
+ mode = (int) TarUtils.parseOctal(header, offset, TarConstants.MODELEN);
offset += TarConstants.MODELEN;
- m_userID = (int)TarUtils.parseOctal( header, offset, TarConstants.UIDLEN );
+ userID = (int) TarUtils.parseOctal(header, offset, TarConstants.UIDLEN);
offset += TarConstants.UIDLEN;
- m_groupID = (int)TarUtils.parseOctal( header, offset, TarConstants.GIDLEN );
+ groupID = (int) TarUtils.parseOctal(header, offset, TarConstants.GIDLEN);
offset += TarConstants.GIDLEN;
- m_size = TarUtils.parseOctal( header, offset, TarConstants.SIZELEN );
+ size = TarUtils.parseOctal(header, offset, TarConstants.SIZELEN);
offset += TarConstants.SIZELEN;
- m_modTime = TarUtils.parseOctal( header, offset, TarConstants.MODTIMELEN );
+ modTime = TarUtils.parseOctal(header, offset, TarConstants.MODTIMELEN);
offset += TarConstants.MODTIMELEN;
- m_checkSum = (int)TarUtils.parseOctal( header, offset, TarConstants.CHKSUMLEN );
+ checkSum = (int) TarUtils.parseOctal(header, offset, TarConstants.CHKSUMLEN);
offset += TarConstants.CHKSUMLEN;
- m_linkFlag = header[ offset++ ];
- m_linkName = TarUtils.parseName( header, offset, NAMELEN );
+ linkFlag = header[offset++];
+ linkName = TarUtils.parseName(header, offset, NAMELEN);
offset += NAMELEN;
- m_magic = TarUtils.parseName( header, offset, TarConstants.MAGICLEN );
+ magic = TarUtils.parseName(header, offset, TarConstants.MAGICLEN);
offset += TarConstants.MAGICLEN;
- m_userName = TarUtils.parseName( header, offset, TarConstants.UNAMELEN );
+ userName = TarUtils.parseName(header, offset, TarConstants.UNAMELEN);
offset += TarConstants.UNAMELEN;
- m_groupName = TarUtils.parseName( header, offset, TarConstants.GNAMELEN );
+ groupName = TarUtils.parseName(header, offset, TarConstants.GNAMELEN);
offset += TarConstants.GNAMELEN;
- m_devMajor = (int)TarUtils.parseOctal( header, offset, TarConstants.DEVLEN );
+ devMajor = (int) TarUtils.parseOctal(header, offset, TarConstants.DEVLEN);
offset += TarConstants.DEVLEN;
- m_devMinor = (int)TarUtils.parseOctal( header, offset, TarConstants.DEVLEN );
+ devMinor = (int) TarUtils.parseOctal(header, offset, TarConstants.DEVLEN);
}
/**
@@ -653,37 +652,37 @@
*
* @param buffer The tar entry header buffer to fill in.
*/
- public void writeEntryHeader( final byte[] buffer )
+ public void writeEntryHeader(final byte[] buffer)
{
int offset = 0;
- offset = TarUtils.getNameBytes( m_name, buffer, offset, NAMELEN );
- offset = TarUtils.getOctalBytes( m_mode, buffer, offset, TarConstants.MODELEN );
- offset = TarUtils.getOctalBytes( m_userID, buffer, offset, TarConstants.UIDLEN );
- offset = TarUtils.getOctalBytes( m_groupID, buffer, offset, TarConstants.GIDLEN );
- offset = TarUtils.getLongOctalBytes( m_size, buffer, offset, TarConstants.SIZELEN );
- offset = TarUtils.getLongOctalBytes( m_modTime, buffer, offset, TarConstants.MODTIMELEN );
+ offset = TarUtils.getNameBytes(name, buffer, offset, NAMELEN);
+ offset = TarUtils.getOctalBytes(mode, buffer, offset, TarConstants.MODELEN);
+ offset = TarUtils.getOctalBytes(userID, buffer, offset, TarConstants.UIDLEN);
+ offset = TarUtils.getOctalBytes(groupID, buffer, offset, TarConstants.GIDLEN);
+ offset = TarUtils.getLongOctalBytes(size, buffer, offset, TarConstants.SIZELEN);
+ offset = TarUtils.getLongOctalBytes(modTime, buffer, offset, TarConstants.MODTIMELEN);
final int checkSumOffset = offset;
- for( int i = 0; i < TarConstants.CHKSUMLEN; ++i )
+ for (int i = 0; i < TarConstants.CHKSUMLEN; ++i)
{
- buffer[ offset++ ] = (byte)' ';
+ buffer[offset++] = (byte) ' ';
}
- buffer[ offset++ ] = m_linkFlag;
- offset = TarUtils.getNameBytes( m_linkName, buffer, offset, NAMELEN );
- offset = TarUtils.getNameBytes( m_magic, buffer, offset, TarConstants.MAGICLEN );
- offset = TarUtils.getNameBytes( m_userName, buffer, offset, TarConstants.UNAMELEN );
- offset = TarUtils.getNameBytes( m_groupName, buffer, offset, TarConstants.GNAMELEN );
- offset = TarUtils.getOctalBytes( m_devMajor, buffer, offset, TarConstants.DEVLEN );
- offset = TarUtils.getOctalBytes( m_devMinor, buffer, offset, TarConstants.DEVLEN );
+ buffer[offset++] = linkFlag;
+ offset = TarUtils.getNameBytes(linkName, buffer, offset, NAMELEN);
+ offset = TarUtils.getNameBytes(magic, buffer, offset, TarConstants.MAGICLEN);
+ offset = TarUtils.getNameBytes(userName, buffer, offset, TarConstants.UNAMELEN);
+ offset = TarUtils.getNameBytes(groupName, buffer, offset, TarConstants.GNAMELEN);
+ offset = TarUtils.getOctalBytes(devMajor, buffer, offset, TarConstants.DEVLEN);
+ offset = TarUtils.getOctalBytes(devMinor, buffer, offset, TarConstants.DEVLEN);
- while( offset < buffer.length )
+ while (offset < buffer.length)
{
- buffer[ offset++ ] = 0;
+ buffer[offset++] = 0;
}
- final long checkSum = TarUtils.computeCheckSum( buffer );
- TarUtils.getCheckSumOctalBytes( checkSum, buffer, checkSumOffset, TarConstants.CHKSUMLEN );
+ final long checkSum = TarUtils.computeCheckSum(buffer);
+ TarUtils.getCheckSumOctalBytes(checkSum, buffer, checkSumOffset, TarConstants.CHKSUMLEN);
}
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileProvider.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileProvider.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java Mon Apr 13 04:06:01 2009
@@ -258,5 +258,5 @@
{
closeCommunicationLink();
}
- */
+ */
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarInputStream.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarInputStream.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarInputStream.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,16 +34,16 @@
* @see TarEntry
*/
class TarInputStream
- extends FilterInputStream
+ extends FilterInputStream
{
- private TarBuffer m_buffer;
- private TarEntry m_currEntry;
- private boolean m_debug;
- private int m_entryOffset;
- private int m_entrySize;
- private boolean m_hasHitEOF;
- private byte[] m_oneBuf;
- private byte[] m_readBuf;
+ private TarBuffer buffer;
+ private TarEntry currEntry;
+ private boolean debug;
+ private int entryOffset;
+ private int entrySize;
+ private boolean hasHitEOF;
+ private byte[] oneBuf;
+ private byte[] readBuf;
/**
* Construct a TarInputStream using specified input
@@ -53,41 +53,41 @@
* @see TarBuffer#DEFAULT_BLOCKSIZE
* @see TarBuffer#DEFAULT_RECORDSIZE
*/
- TarInputStream( final InputStream input )
+ TarInputStream(final InputStream input)
{
- this( input, TarBuffer.DEFAULT_BLOCKSIZE, TarBuffer.DEFAULT_RECORDSIZE );
+ this(input, TarBuffer.DEFAULT_BLOCKSIZE, TarBuffer.DEFAULT_RECORDSIZE);
}
/**
* Construct a TarInputStream using specified input
* stream, block size and default record sizes.
*
- * @param input stream to create TarInputStream from
+ * @param input stream to create TarInputStream from
* @param blockSize the block size to use
* @see TarBuffer#DEFAULT_RECORDSIZE
*/
- TarInputStream( final InputStream input,
- final int blockSize )
+ TarInputStream(final InputStream input,
+ final int blockSize)
{
- this( input, blockSize, TarBuffer.DEFAULT_RECORDSIZE );
+ this(input, blockSize, TarBuffer.DEFAULT_RECORDSIZE);
}
/**
* Construct a TarInputStream using specified input
* stream, block size and record sizes.
*
- * @param input stream to create TarInputStream from
- * @param blockSize the block size to use
+ * @param input stream to create TarInputStream from
+ * @param blockSize the block size to use
* @param recordSize the record size to use
*/
- TarInputStream( final InputStream input,
- final int blockSize,
- final int recordSize )
+ TarInputStream(final InputStream input,
+ final int blockSize,
+ final int recordSize)
{
- super( input );
+ super(input);
- m_buffer = new TarBuffer( input, blockSize, recordSize );
- m_oneBuf = new byte[ 1 ];
+ buffer = new TarBuffer(input, blockSize, recordSize);
+ oneBuf = new byte[1];
}
/**
@@ -95,10 +95,10 @@
*
* @param debug The new Debug value
*/
- public void setDebug( final boolean debug )
+ public void setDebug(final boolean debug)
{
- m_debug = debug;
- m_buffer.setDebug( debug );
+ this.debug = debug;
+ buffer.setDebug(debug);
}
/**
@@ -110,105 +110,106 @@
* end of the archive has been reached.
*
* @return The next TarEntry in the archive, or null.
- * @exception IOException Description of Exception
+ * @throws IOException Description of Exception
*/
public TarEntry getNextEntry()
- throws IOException
+ throws IOException
{
- if( m_hasHitEOF )
+ if (hasHitEOF)
{
return null;
}
- if( m_currEntry != null )
+ if (currEntry != null)
{
- final int numToSkip = m_entrySize - m_entryOffset;
+ final int numToSkip = entrySize - entryOffset;
- if( m_debug )
+ if (debug)
{
final String message = "TarInputStream: SKIP currENTRY '" +
- m_currEntry.getName() + "' SZ " + m_entrySize +
- " OFF " + m_entryOffset + " skipping " + numToSkip + " bytes";
- debug( message );
+ currEntry.getName() + "' SZ " + entrySize +
+ " OFF " + entryOffset + " skipping " + numToSkip + " bytes";
+ debug(message);
}
- if( numToSkip > 0 )
+ if (numToSkip > 0)
{
- skip( numToSkip );
+ skip(numToSkip);
}
- m_readBuf = null;
+ readBuf = null;
}
- final byte[] headerBuf = m_buffer.readRecord();
- if( headerBuf == null )
+ final byte[] headerBuf = buffer.readRecord();
+ if (headerBuf == null)
{
- if( m_debug )
+ if (debug)
{
- debug( "READ NULL RECORD" );
+ debug("READ NULL RECORD");
}
- m_hasHitEOF = true;
+ hasHitEOF = true;
}
- else if( m_buffer.isEOFRecord( headerBuf ) )
+ else if (buffer.isEOFRecord(headerBuf))
{
- if( m_debug )
+ if (debug)
{
- debug( "READ EOF RECORD" );
+ debug("READ EOF RECORD");
}
- m_hasHitEOF = true;
+ hasHitEOF = true;
}
- if( m_hasHitEOF )
+ if (hasHitEOF)
{
- m_currEntry = null;
+ currEntry = null;
}
else
{
- m_currEntry = new TarEntry( headerBuf );
+ currEntry = new TarEntry(headerBuf);
- if( !( headerBuf[ 257 ] == 'u' && headerBuf[ 258 ] == 's' &&
- headerBuf[ 259 ] == 't' && headerBuf[ 260 ] == 'a' &&
- headerBuf[ 261 ] == 'r' ) )
+ if (!(headerBuf[257] == 'u' && headerBuf[258] == 's' &&
+ headerBuf[259] == 't' && headerBuf[260] == 'a' &&
+ headerBuf[261] == 'r'))
{
//Must be v7Format
}
- if( m_debug )
+ if (debug)
{
final String message = "TarInputStream: SET CURRENTRY '" +
- m_currEntry.getName() + "' size = " + m_currEntry.getSize();
- debug( message );
+ currEntry.getName() + "' size = " + currEntry.getSize();
+ debug(message);
}
- m_entryOffset = 0;
+ entryOffset = 0;
// REVIEW How do we resolve this discrepancy?!
- m_entrySize = (int)m_currEntry.getSize();
+ entrySize = (int) currEntry.getSize();
}
- if( null != m_currEntry && m_currEntry.isGNULongNameEntry() )
+ if (null != currEntry && currEntry.isGNULongNameEntry())
{
// read in the name
final StringBuffer longName = new StringBuffer();
- final byte[] buffer = new byte[ 256 ];
+ final byte[] buffer = new byte[256];
int length = 0;
- while( ( length = read( buffer ) ) >= 0 )
+ while ((length = read(buffer)) >= 0)
{
- final String str = new String( buffer, 0, length );
- longName.append( str );
+ final String str = new String(buffer, 0, length);
+ longName.append(str);
}
getNextEntry();
// remove trailing null terminator
if (longName.length() > 0
- && longName.charAt(longName.length() - 1) == 0) {
+ && longName.charAt(longName.length() - 1) == 0)
+ {
longName.deleteCharAt(longName.length() - 1);
}
-
- m_currEntry.setName( longName.toString() );
+
+ currEntry.setName(longName.toString());
}
- return m_currEntry;
+ return currEntry;
}
/**
@@ -218,7 +219,7 @@
*/
public int getRecordSize()
{
- return m_buffer.getRecordSize();
+ return buffer.getRecordSize();
}
/**
@@ -229,23 +230,23 @@
* current entry.
*
* @return The number of available bytes for the current entry.
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
public int available()
- throws IOException
+ throws IOException
{
- return m_entrySize - m_entryOffset;
+ return entrySize - entryOffset;
}
/**
* Closes this stream. Calls the TarBuffer's close() method.
*
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
public void close()
- throws IOException
+ throws IOException
{
- m_buffer.close();
+ buffer.close();
}
/**
@@ -253,21 +254,21 @@
* output stream.
*
* @param output The OutputStream into which to write the entry's data.
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
- public void copyEntryContents( final OutputStream output )
- throws IOException
+ public void copyEntryContents(final OutputStream output)
+ throws IOException
{
- final byte[] buffer = new byte[ 32 * 1024 ];
- while( true )
+ final byte[] buffer = new byte[32 * 1024];
+ while (true)
{
- final int numRead = read( buffer, 0, buffer.length );
- if( numRead == -1 )
+ final int numRead = read(buffer, 0, buffer.length);
+ if (numRead == -1)
{
break;
}
- output.write( buffer, 0, numRead );
+ output.write(buffer, 0, numRead);
}
}
@@ -276,7 +277,7 @@
*
* @param markLimit The limit to mark.
*/
- public void mark( int markLimit )
+ public void mark(int markLimit)
{
}
@@ -295,19 +296,19 @@
* read( byte[], int, int ).
*
* @return The byte read, or -1 at EOF.
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
public int read()
- throws IOException
+ throws IOException
{
- final int num = read( m_oneBuf, 0, 1 );
- if( num == -1 )
+ final int num = read(oneBuf, 0, 1);
+ if (num == -1)
{
return num;
}
else
{
- return m_oneBuf[ 0 ];
+ return oneBuf[0];
}
}
@@ -317,12 +318,12 @@
*
* @param buffer The buffer into which to place bytes read.
* @return The number of bytes read, or -1 at EOF.
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
- public int read( final byte[] buffer )
- throws IOException
+ public int read(final byte[] buffer)
+ throws IOException
{
- return read( buffer, 0, buffer.length );
+ return read(buffer, 0, buffer.length);
}
/**
@@ -332,48 +333,48 @@
*
* @param buffer The buffer into which to place bytes read.
* @param offset The offset at which to place bytes read.
- * @param count The number of bytes to read.
+ * @param count The number of bytes to read.
* @return The number of bytes read, or -1 at EOF.
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
- public int read( final byte[] buffer,
- final int offset,
- final int count )
- throws IOException
+ public int read(final byte[] buffer,
+ final int offset,
+ final int count)
+ throws IOException
{
int position = offset;
int numToRead = count;
int totalRead = 0;
- if( m_entryOffset >= m_entrySize )
+ if (entryOffset >= entrySize)
{
return -1;
}
- if( ( numToRead + m_entryOffset ) > m_entrySize )
+ if ((numToRead + entryOffset) > entrySize)
{
- numToRead = ( m_entrySize - m_entryOffset );
+ numToRead = (entrySize - entryOffset);
}
- if( null != m_readBuf )
+ if (null != readBuf)
{
final int size =
- ( numToRead > m_readBuf.length ) ? m_readBuf.length : numToRead;
+ (numToRead > readBuf.length) ? readBuf.length : numToRead;
- System.arraycopy( m_readBuf, 0, buffer, position, size );
+ System.arraycopy(readBuf, 0, buffer, position, size);
- if( size >= m_readBuf.length )
+ if (size >= readBuf.length)
{
- m_readBuf = null;
+ readBuf = null;
}
else
{
- final int newLength = m_readBuf.length - size;
- final byte[] newBuffer = new byte[ newLength ];
+ final int newLength = readBuf.length - size;
+ final byte[] newBuffer = new byte[newLength];
- System.arraycopy( m_readBuf, size, newBuffer, 0, newLength );
+ System.arraycopy(readBuf, size, newBuffer, 0, newLength);
- m_readBuf = newBuffer;
+ readBuf = newBuffer;
}
totalRead += size;
@@ -381,33 +382,33 @@
position += size;
}
- while( numToRead > 0 )
+ while (numToRead > 0)
{
- final byte[] rec = m_buffer.readRecord();
- if( null == rec )
+ final byte[] rec = this.buffer.readRecord();
+ if (null == rec)
{
// Unexpected EOF!
final String message =
- "unexpected EOF with " + numToRead + " bytes unread";
- throw new IOException( message );
+ "unexpected EOF with " + numToRead + " bytes unread";
+ throw new IOException(message);
}
int size = numToRead;
final int recordLength = rec.length;
- if( recordLength > size )
+ if (recordLength > size)
{
- System.arraycopy( rec, 0, buffer, position, size );
+ System.arraycopy(rec, 0, buffer, position, size);
- m_readBuf = new byte[ recordLength - size ];
+ readBuf = new byte[recordLength - size];
- System.arraycopy( rec, size, m_readBuf, 0, recordLength - size );
+ System.arraycopy(rec, size, readBuf, 0, recordLength - size);
}
else
{
size = recordLength;
- System.arraycopy( rec, 0, buffer, position, recordLength );
+ System.arraycopy(rec, 0, buffer, position, recordLength);
}
totalRead += size;
@@ -415,7 +416,7 @@
position += size;
}
- m_entryOffset += totalRead;
+ entryOffset += totalRead;
return totalRead;
}
@@ -433,22 +434,22 @@
* entry's data if the number to skip extends beyond that point.
*
* @param numToSkip The number of bytes to skip.
- * @exception IOException when an IO error causes operation to fail
+ * @throws IOException when an IO error causes operation to fail
*/
- public void skip( final int numToSkip )
- throws IOException
+ public void skip(final int numToSkip)
+ throws IOException
{
// REVIEW
// This is horribly inefficient, but it ensures that we
// properly skip over bytes via the TarBuffer...
//
- final byte[] skipBuf = new byte[ 8 * 1024 ];
+ final byte[] skipBuf = new byte[8 * 1024];
int num = numToSkip;
- while( num > 0 )
+ while (num > 0)
{
- final int count = ( num > skipBuf.length ) ? skipBuf.length : num;
- final int numRead = read( skipBuf, 0, count );
- if( numRead == -1 )
+ final int count = (num > skipBuf.length) ? skipBuf.length : num;
+ final int numRead = read(skipBuf, 0, count);
+ if (numRead == -1)
{
break;
}
@@ -463,11 +464,11 @@
*
* @param message the message to use in debugging
*/
- protected void debug( final String message )
+ protected void debug(final String message)
{
- if( m_debug )
+ if (debug)
{
- System.err.println( message );
+ System.err.println(message);
}
}
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarUtils.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarUtils.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TarUtils.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,19 +30,19 @@
*
* @param offset The offset into the buffer from which to parse.
* @param length The number of header bytes to parse.
- * @param value Description of Parameter
- * @param buf Description of Parameter
+ * @param value Description of Parameter
+ * @param buf Description of Parameter
* @return The integer value of the entry's checksum.
*/
- public static int getCheckSumOctalBytes( final long value,
- final byte[] buf,
- final int offset,
- final int length )
+ public static int getCheckSumOctalBytes(final long value,
+ final byte[] buf,
+ final int offset,
+ final int length)
{
- getOctalBytes( value, buf, offset, length );
+ getOctalBytes(value, buf, offset, length);
- buf[ offset + length - 1 ] = (byte)' ';
- buf[ offset + length - 2 ] = 0;
+ buf[offset + length - 1] = (byte) ' ';
+ buf[offset + length - 2] = 0;
return offset + length;
}
@@ -52,19 +52,19 @@
*
* @param offset The offset into the buffer from which to parse.
* @param length The number of header bytes to parse.
- * @param value Description of Parameter
- * @param buf Description of Parameter
+ * @param value Description of Parameter
+ * @param buf Description of Parameter
* @return The long value of the octal bytes.
*/
- public static int getLongOctalBytes( final long value,
- final byte[] buf,
- final int offset,
- final int length )
+ public static int getLongOctalBytes(final long value,
+ final byte[] buf,
+ final int offset,
+ final int length)
{
- byte[] temp = new byte[ length + 1 ];
+ byte[] temp = new byte[length + 1];
- getOctalBytes( value, temp, 0, length + 1 );
- System.arraycopy( temp, 0, buf, offset, length );
+ getOctalBytes(value, temp, 0, length + 1);
+ System.arraycopy(temp, 0, buf, offset, length);
return offset + length;
}
@@ -74,25 +74,25 @@
*
* @param offset The offset into the buffer from which to parse.
* @param length The number of header bytes to parse.
- * @param name Description of Parameter
+ * @param name Description of Parameter
* @param buffer Description of Parameter
* @return The number of bytes in a header's entry name.
*/
- public static int getNameBytes( final StringBuffer name,
- final byte[] buffer,
- final int offset,
- final int length )
+ public static int getNameBytes(final StringBuffer name,
+ final byte[] buffer,
+ final int offset,
+ final int length)
{
int i;
- for( i = 0; i < length && i < name.length(); ++i )
+ for (i = 0; i < length && i < name.length(); ++i)
{
- buffer[ offset + i ] = (byte)name.charAt( i );
+ buffer[offset + i] = (byte) name.charAt(i);
}
- for( ; i < length; ++i )
+ for (; i < length; ++i)
{
- buffer[ offset + i ] = 0;
+ buffer[offset + i] = 0;
}
return offset + length;
@@ -105,37 +105,37 @@
* @param length The number of header bytes to parse.
* @return The integer value of the octal bytes.
*/
- public static int getOctalBytes( final long value,
- final byte[] buffer,
- final int offset,
- final int length )
+ public static int getOctalBytes(final long value,
+ final byte[] buffer,
+ final int offset,
+ final int length)
{
int idx = length - 1;
- buffer[ offset + idx ] = 0;
+ buffer[offset + idx] = 0;
--idx;
- buffer[ offset + idx ] = (byte)' ';
+ buffer[offset + idx] = (byte) ' ';
--idx;
- if( value == 0 )
+ if (value == 0)
{
- buffer[ offset + idx ] = (byte)'0';
+ buffer[offset + idx] = (byte) '0';
--idx;
}
else
{
long val = value;
- while( idx >= 0 && val > 0 )
+ while (idx >= 0 && val > 0)
{
- buffer[ offset + idx ] = (byte)( (byte)'0' + (byte)( val & 7 ) );
+ buffer[offset + idx] = (byte) ((byte) '0' + (byte) (val & 7));
val = val >> 3;
idx--;
}
}
- while( idx >= 0 )
+ while (idx >= 0)
{
- buffer[ offset + idx ] = (byte)' ';
+ buffer[offset + idx] = (byte) ' ';
idx--;
}
@@ -148,13 +148,13 @@
* @param buffer The tar entry's header buffer.
* @return The computed checksum.
*/
- public static long computeCheckSum( final byte[] buffer )
+ public static long computeCheckSum(final byte[] buffer)
{
long sum = 0;
- for( int i = 0; i < buffer.length; ++i )
+ for (int i = 0; i < buffer.length; ++i)
{
- sum += 255 & buffer[ i ];
+ sum += 255 & buffer[i];
}
return sum;
@@ -168,21 +168,21 @@
* @param length The number of header bytes to parse.
* @return The header's entry name.
*/
- public static StringBuffer parseName( final byte[] header,
- final int offset,
- final int length )
+ public static StringBuffer parseName(final byte[] header,
+ final int offset,
+ final int length)
{
- StringBuffer result = new StringBuffer( length );
+ StringBuffer result = new StringBuffer(length);
int end = offset + length;
- for( int i = offset; i < end; ++i )
+ for (int i = offset; i < end; ++i)
{
- if( header[ i ] == 0 )
+ if (header[i] == 0)
{
break;
}
- result.append( (char)header[ i ] );
+ result.append((char) header[i]);
}
return result;
@@ -197,36 +197,36 @@
* @param length The number of header bytes to parse.
* @return The long value of the octal string.
*/
- public static long parseOctal( final byte[] header,
- final int offset,
- final int length )
+ public static long parseOctal(final byte[] header,
+ final int offset,
+ final int length)
{
long result = 0;
boolean stillPadding = true;
int end = offset + length;
- for( int i = offset; i < end; ++i )
+ for (int i = offset; i < end; ++i)
{
- if( header[ i ] == 0 )
+ if (header[i] == 0)
{
break;
}
- if( header[ i ] == (byte)' ' || header[ i ] == '0' )
+ if (header[i] == (byte) ' ' || header[i] == '0')
{
- if( stillPadding )
+ if (stillPadding)
{
continue;
}
- if( header[ i ] == (byte)' ' )
+ if (header[i] == (byte) ' ')
{
break;
}
}
stillPadding = false;
- result = ( result << 3 ) + ( header[ i ] - '0' );
+ result = (result << 3) + (header[i] - '0');
}
return result;
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/Tbz2FileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/Tbz2FileProvider.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/Tbz2FileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/Tbz2FileProvider.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TgzFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TgzFileProvider.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TgzFileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/tar/TgzFileProvider.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/temp/TemporaryFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/temp/TemporaryFileProvider.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/temp/TemporaryFileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/temp/TemporaryFileProvider.java Mon Apr 13 04:06:01 2009
@@ -96,7 +96,7 @@
final String scheme = UriParser.extractScheme(uri, buffer);
UriParser.fixSeparators(buffer);
-
+
FileType fileType = UriParser.normalisePath(buffer);
final String path = buffer.toString();
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/ExceptionConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/ExceptionConverter.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/ExceptionConverter.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/ExceptionConverter.java Mon Apr 13 04:06:01 2009
@@ -26,9 +26,10 @@
import java.lang.reflect.Constructor;
/**
- * <code>ExceptionConverter</code>...
+ * <code>ExceptionConverter</code> converts WebDAV exceptions into FileSystemExceptions.
+ * @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
*/
-public class ExceptionConverter
+public final class ExceptionConverter
{
// avoid instanciation
private ExceptionConverter()
@@ -86,4 +87,4 @@
return new FileSystemException(msg);
}
-}
\ No newline at end of file
+}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileContentInfoFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileContentInfoFactory.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileContentInfoFactory.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileContentInfoFactory.java Mon Apr 13 04:06:01 2009
@@ -28,7 +28,7 @@
import org.apache.jackrabbit.webdav.property.DavPropertySet;
/**
- * Description
+ * Determines the content information for files accessed via WebDAV.
*
* @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
* @version $Revision$
@@ -44,19 +44,19 @@
DavPropertyNameSet nameSet = new DavPropertyNameSet();
nameSet.add(DavPropertyName.GETCONTENTTYPE);
- DavPropertySet propertySet = file.getProperties((URLFileName)file.getName(), nameSet, true);
+ DavPropertySet propertySet = file.getProperties((URLFileName) file.getName(), nameSet, true);
DavProperty property = propertySet.get(DavPropertyName.GETCONTENTTYPE);
- if ( property != null )
+ if (property != null)
{
contentType = (String) property.getValue();
}
property = propertySet.get(WebdavFileObject.RESPONSE_CHARSET);
- if ( property != null )
+ if (property != null)
{
contentEncoding = (String) property.getValue();
}
return new DefaultFileContentInfo(contentType, contentEncoding);
}
-}
\ No newline at end of file
+}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileNameParser.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileNameParser.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileNameParser.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileNameParser.java Mon Apr 13 04:06:01 2009
@@ -25,7 +25,7 @@
*/
public class WebdavFileNameParser extends HttpFileNameParser
{
- private final static WebdavFileNameParser INSTANCE = new WebdavFileNameParser();
+ private static final WebdavFileNameParser INSTANCE = new WebdavFileNameParser();
public WebdavFileNameParser()
{
@@ -36,4 +36,4 @@
{
return INSTANCE;
}
-}
\ No newline at end of file
+}