Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 206967 Details for
Bug 280453
[performance] DefaultFileServiceCodePageConverter is wasteful with main memory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
patch.txt (text/plain), 3.97 KB, created by
David McKnight
on 2011-11-14 12:38:08 EST
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
David McKnight
Created:
2011-11-14 12:38:08 EST
Size:
3.97 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services >Index: src/org/eclipse/rse/services/files/DefaultFileServiceCodePageConverter.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/DefaultFileServiceCodePageConverter.java,v >retrieving revision 1.10 >diff -u -r1.10 DefaultFileServiceCodePageConverter.java >--- src/org/eclipse/rse/services/files/DefaultFileServiceCodePageConverter.java 25 Feb 2011 14:30:51 -0000 1.10 >+++ src/org/eclipse/rse/services/files/DefaultFileServiceCodePageConverter.java 14 Nov 2011 17:37:21 -0000 >@@ -75,27 +75,11 @@ > bufInputStream.read(buffer, 0, fileLength); > bufInputStream.close(); > inputStream.close(); >- >- ByteBuffer rmtBuf = ByteBuffer.wrap(buffer, 0, fileLength); >- >- // convert from the remote encoding >- CharBuffer decodedBuf = null; >- decodedBuf = rmtDecoder.decode(rmtBuf); >- // for conversion to the local encoding >- Charset charset = Charset.forName(localEncoding); >- CharsetEncoder encoder = charset.newEncoder(); >- byte[] localBuffer = null; >- // convert to the specified local encoding >- ByteBuffer lclBuf = encoder.encode(decodedBuf); >- localBuffer = lclBuf.array(); >- >- // use the limit rather than the array length to avoid unwanted nulls > outStream = new FileOutputStream(file); >- outStream.write(localBuffer, 0, lclBuf.limit()); >+ convertBuffer(buffer, rmtDecoder, fileLength, localEncoding, outStream); > } > else { // read and write sections of file at a time > int inOffset = 0; >- int outOffset = 0; > > File altFile = new File(file.getAbsolutePath() + "~"); //$NON-NLS-1$ > outStream = new FileOutputStream(altFile); // using alternate file because we're writing while reading >@@ -104,28 +88,10 @@ > if (inOffset + MAX_READ > fileLength){ > readSize = fileLength - inOffset; > } >- > byte[] buffer = new byte[readSize]; > inputStream.read(buffer, 0, readSize); > inOffset += readSize; >- ByteBuffer rmtBuf = ByteBuffer.wrap(buffer, 0, readSize); >- >- // convert from the remote encoding >- CharBuffer decodedBuf = null; >- decodedBuf = rmtDecoder.decode(rmtBuf); >- >- // for conversion to the local encoding >- Charset charset = Charset.forName(localEncoding); >- CharsetEncoder encoder = charset.newEncoder(); >- byte[] localBuffer = null; >- // convert to the specified local encoding >- ByteBuffer lclBuf = encoder.encode(decodedBuf); >- localBuffer = lclBuf.array(); >- >- // use the limit rather than the array length to avoid unwanted nulls >- int writeSize = lclBuf.limit(); >- outStream.write(localBuffer, 0, writeSize); >- outOffset += writeSize; >+ convertBuffer(buffer, rmtDecoder, readSize, localEncoding, outStream); > } > inputStream.close(); > outStream.close(); >@@ -151,6 +117,27 @@ > } > } > } >+ >+ private void convertBuffer(byte[] buffer, CharsetDecoder rmtDecoder, int readSize, String localEncoding, FileOutputStream outStream) throws Exception{ >+ ByteBuffer rmtBuf = ByteBuffer.wrap(buffer, 0, readSize); >+ >+ // convert from the remote encoding >+ CharBuffer decodedBuf = null; >+ decodedBuf = rmtDecoder.decode(rmtBuf); >+ >+ // for conversion to the local encoding >+ Charset charset = Charset.forName(localEncoding); >+ CharsetEncoder encoder = charset.newEncoder(); >+ byte[] localBuffer = null; >+ >+ // convert to the specified local encoding >+ ByteBuffer lclBuf = encoder.encode(decodedBuf); >+ localBuffer = lclBuf.array(); >+ >+ // use the limit rather than the array length to avoid unwanted nulls >+ int writeSize = lclBuf.limit(); >+ outStream.write(localBuffer, 0, writeSize); >+ } > > public boolean isServerEncodingSupported(String remoteEncoding, > IFileService fs) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 280453
:
189805
| 206967 |
212941